Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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);
            }
        }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #download #file #url #asp #net #web #api
ADD COMMENT
Topic
Name
3+9 =