In my project, i have used HtmlAgilityPack library to capture the page and parse it.
1. First you create a asp.net project and add HtmlAgilityPack reference in your project.
2. Create a 'HtmlWeb' object
3. Load the html page using 'HtmlDocument'
4. now you get html page in 'HtmlDocument' object.
5. You can display this 'HtmlDocument' object in asp 'Literal' control.
the code this below
HtmlWeb hwObject = new HtmlWeb();
HtmlDocument htmldocObject = hwObject.Load("http://www.c-sharpcorner.com");
lLatestPrice.Text = htmldocObject.DocumentNode.InnerHtml;
You can find all link from this page using a loop like this
foreach (HtmlNode link in
htmldocObject.DocumentNode.SelectNodes("//a[@href]"))
{
string s = link.InnerText;
}
thats it.....
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

Sunil ReddyPosted Nov 12, 2018, 7:20 AM
How can i scrape two different child node patterns in a single line of pattern code
Adeel KhalidPosted May 21, 2015, 2:09 AM
you've posted this for just a page, i mean how can we scrape whole website? make it in a recursive function or try some other logic?
Mike GoldPosted Apr 26, 2010, 11:00 AM
I will keep this library in mind for future project.