I have a web service, like this example for downloading a zip file from the server. When i open the URL through web browsers,I can download the zip file correctly. The probl
You can try to use HttpClient instead. Usually, it is more convenient.
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);
}
}