You can use HttpClientfrom System.Net.Http. I recommend using .NET Core 2.0.
public async Task<bool> Download()
{
var client = new HttpClient();
var response = await client.GetAsync("https://github.com/twbs/bootstrap/releases/download/v4.0.0-beta/bootstrap-4.0.0-beta-dist.zip");
using(var fs = new FileStream(@"c:\_data\bootstrap-4.0.0-beta-dist.zip", FileMode.Create))
{
await response.Content.ReadAsStreamAsync().Result.CopyToAsync(fs);
}
return true;
}
source
share