I want to read the content of the Remote Webpage in asp.net using C#. I have read it using the following code in asp.net.
protected void Page_Load(object sender, EventArgs e)
{
string TheUrl = "http://www.demosite.com/Default.aspx";
string response = GetHtmlPage(TheUrl);
Response.Write(response);
}
static string GetHtmlPage(string strURL)
{
String strResult;
WebResponse objResponse;
WebRequest objRequest = HttpWebRequest.Create(strURL);
objResponse = objRequest.GetResponse();
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
strResult = sr.ReadToEnd();
sr.Close();
}
return strResult;
}
Here i get the whole content of the Remote WebPage now i want read the content Tag by tag and get Only the Content of it. Is it possible?
Help Appreciated...! Thanks in advance!