How to download a file from the Internet using C#?

using System.Net;
using (WebClient webClient = new WebClient())
    webClient.DownloadFile(remoteUrl, localDestination);

-or-

using (HttpClient client = new HttpClient())
{
    var contents = await client.GetStringAsync(url1);
    await File.WriteAllTextAsync(filePath, contents);
}