Reputation: 1
I want the fastest method to download the source of HTML with given URL address Is there any solution beyond normal C# solutions like (WebClient Download or HttpWebRequest, HttpWebResponse) that speed up fetching HTML source code ??
Upvotes: 0
Views: 1471
Reputation: 503
I normally just use this function when downloading and viewing html.
string getHtml(string url)
{
HttpWebRequest myWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
myWebRequest.Method = "GET";
// make request for web page
HttpWebResponse myWebResponse = (HttpWebResponse)myWebRequest.GetResponse();
StreamReader myWebSource = new StreamReader(myWebResponse.GetResponseStream());
string myPageSource = string.Empty;
myPageSource = myWebSource.ReadToEnd();
myWebResponse.Close();
return myPageSource;
}
http://www.devasp.net/net/articles/display/994.html
Upvotes: 1