This project has moved and is read-only. For the latest updates, please go here.

Find all href links on page

Topics: User Forum
May 24, 2011 at 1:05 AM
Edited May 24, 2011 at 1:06 AM

Hi i have all i have got this code that is working for the most part but i dose not find all href links on the page.

What i am trying to do is get every single link the page has and i mean every single one lol.

HtmlDocument htmlDoc = new HtmlDocument();

List<string> hrefTags = new List<string>();
foreach (HtmlNode node in htmlDoc.DocumentNode.SelectNodes("//a"))
    hrefTags.Add(node.GetAttributeValue("href", null));

How would i go about this thanks.

May 25, 2011 at 6:43 PM

What I put here will work.