Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to get innertext of particular tag from web page by using class name...url like www.google.com or www.wikipedia.com etc.

For this i used below code(HtmlAgilityPack)...

C#
            string url = string.Empty;
            url = TextWeburl.Text;

            HtmlDocument htmlDoc = new HtmlDocument();
            htmlDoc.LoadHtml(url);
//            XPathNavigator docNav = htmlDoc.CreateNavigator();

//            XPathNavigator node = docNav.SelectSingleNode("//p");

            string name = htmlDoc.DocumentNode.SelectSingleNode("//p/span").Attributes["theGood"].Value;


but it takes null value in string...

is there any better way to solve this issue???
Posted

1 solution

Hi Balasubramanian,
I would recommend you to go through the following links as they give you the idea of reading the value from a given url to get the Title and Description of the website. You could also make use of this reference for taking the innertext or value by classname with the url you specify.

http://blogs.msdn.com/b/noahc/archive/2007/02/19/get-a-web-page-s-title-from-a-url-c.aspx[^]
http://www.c-sharpcorner.com/UploadFile/c63ec5/get-title-and-meta-description-of-live-url/[^]
 
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