Code to get an html page
Got this code online while searching for code to send a webpage in an email using ASP.net
Source - Cant Remember
///
/// Function used to get the page to be sent
///
///
///
private String readHtmlPage(string url)
{
String result;
WebResponse objResponse;
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
return result;
}
Source - Cant Remember
///
/// Function used to get the page to be sent
///
///
///
private String readHtmlPage(string url)
{
String result;
WebResponse objResponse;
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()))
{
result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
return result;
}
Labels: ASP.net

0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home