Introduction
The article is regarding how to get the HTML source of any webpage without being redirected to a particular webpage.
Using the code
Go through the following code to know how to get the HTML source
from any webpage without being redirected in ASP.NET:
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;
}