Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to find the how many link in html files like button,hyperlink etc
Posted

1 solution

If you are open to use tool, HTMLAgilityPack is the right tool, I would say. It is open-source, free and pretty versatile.

http://htmlagilitypack.codeplex.com/[^]

A simple snippet
C#
HtmlWeb hw = new HtmlWeb();
 HtmlDocument htmlDoc = hw.Load("www.yoursite.com/default.aspx);
 foreach(HtmlNode eachLink in htmlDoc.DocumentElement.SelectNodes("//a[@href]"))
 {

 }

If you want to write your own tool, I would suggest to have a look at http://www.dotnetperls.com/scraping-html[^]

Though, this is just begining and you may face lots of issues if you are trying to scrap other sites as the internet is full of badly written sites :-(

Hope that helps. If it does, mark the answer /upvote.

Thanks
Milind
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900