Given a URL, what would be the most efficient code to download the contents of that web page? I am only considering the HTML, not associated images, JS and CSS.
I think this is the fastest (download speed time with low latency) solution for download.
// WebClient vs HttpClient vs HttpWebRequest vs RestSharp
// در نهایت به نظرم روش زیر سریعترین روشه
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(url);
Request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
Request.Proxy = null;
Request.Method = "GET";
using (WebResponse Response = Request.GetResponse())
{
using (StreamReader Reader = new StreamReader(Response.GetResponseStream()))
{
return Reader.ReadToEnd();
}
}