Take a look at using the Html Agility Pack
Example of its use:
HtmlDocument doc = new HtmlDocument();
doc.Load("file.htm");
foreach(HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]")
{
HtmlAttribute att = link["href"];
att.Value = FixLink(att);
}