Monday, July 27, 2009

Read html of any web page

Step 1: Create string type variable and assign function "readHtmlPage" to this, this function will take any web page URL of which sourcecode you want to read

string strResult = readHtmlPage("ANY web page url");

Step 2: Create the function "readHtmlPage"


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;
}

2 comments:

Anonymous said...

leaperGraky
awbd

Anonymous said...

Join the top rated casino online and get up to $777 in free bonuses! Download for free or play right online, there are over 85 games to choose from. We welcome U.S. players from every state!
[URL=http://durakoff.net/gforum/link/online%20casino%20gambling/2_gambling2.html][IMG]http://durakoff.net/gforum/imggforum/online%20casino%20gambling/2_gambling2.png[/IMG][/URL]
[url=http://jqtuooi.angelcities.com/index.html]aygestin [/url]