HTML Agility Pack Replace Links
See the question and my original answer on StackOverflowThis should work better:
foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]"))
{
HtmlAttribute att = link.Attributes["href"];
att.Value = RepairHyperlinkAddress(att.Value, web);
}
foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//img[@src]"))
{
HtmlAttribute att = link.Attributes["src"];
att.Value = RepairHyperlinkAddress(att.Value, web);
}