Hi
Suppose you just want to take updates of your Code Project profile. Copy the Url of your profile in "_codeProjectProfile" and run the code below. This also takes the CSS as shown in your profile to make sure it appears correctly formatted.
In such codes, you just have to take the html as an xml structure and identify the wanted blocks as XmlNode. The purpose is to get the XPath of your desired node :)
If this serves for your purpose, please vote as answered.
var webGet = new HtmlWeb();
var document = webGet.Load(_codeProjectProfile);
var stylesheets = document.DocumentNode.SelectNodes("@//link[@rel='stylesheet']");
List<string> cssFiles = new List<string>();
foreach (var style in stylesheets)
{
cssFiles.Add(style.Attributes["href"].Value);
}
var wantedNode = document.DocumentNode.SelectSingleNode("//table[@class='member-profile']");
if (null != wantedNode)
{
cssFiles.ForEach(css =>
{
string script = "<link rel="\"stylesheet\"" type="\"text/css\"" href="\""+css" />";
Page.Header.Controls.Add(new LiteralControl(script));
});
divSiteCodeProject.InnerHtml = wantedNode.OuterHtml;
}
</string></string>