Facebook

Read html, text or content between HTML tag c#. .NET

It is very easy to read content between HTML tag using c#. Steps for reading HTML content are as follows:

  • Using namespace System.Xml
  • Code:
 XmlDocument a=new XmlDocument();
        a.Load(Server.MapPath("~") + "//a.html");
        XmlNode n = a.SelectSingleNode("/html/body");
        TextBox1.Text = n.InnerXml;

Note:

  • Be sure about case sensitivity of tag example (/HTML/BODY) in place of (/html/body).

Leave a Reply

Your email address will not be published. Required fields are marked *