I want to get source code of some website.
I found this solution:
var html = System.Net.WebClient().DownloadString(siteUrl);
But Vi
This is what I currently use to download HTML source from webpages:
public static async Task DownloadPageAsync(string pageURL)
{
using (HttpClient client = new HttpClient())
using (HttpResponseMessage response = await client.GetAsync(page))
using (HttpContent content = response.Content)
{
string result = await content.ReadAsStringAsync();
return result;
}
}
This function will return downloaded html of pageURL.