Answers for ".net download file from url"

C#
4

how to download file from url using c#

using (var client = new WebClient())
{
    client.DownloadFile("http://example.com/file/song/a.mpeg", "a.mpeg");
}
Posted by: Guest on September-22-2020
1

download file from url asp net web api c#

var client = new HttpClient();
        var response = await client.GetAsync(@"http://localhost:9000/api/file/GetFile?filename=myPackage.zip");

        using (var stream = await response.Content.ReadAsStreamAsync())
        {
            var fileInfo = new FileInfo("myPackage.zip");
            using (var fileStream = fileInfo.OpenWrite())
            {
                await stream.CopyToAsync(fileStream);
            }
        }
Posted by: Guest on June-03-2020

Code answers related to ".net download file from url"

C# Answers by Framework

Browse Popular Code Answers by Language