Whenever I use WebClient.DownloadFile (), the resulting file length is always 0 bytes. I tried files from different sites, including my own IIS locally, I always get a file with a length of 0 bytes. When you click on the file name in the browser (Chrome), the file loads correctly.
string fileName = @"us_ysera_tier11.json.gz";
string remoteUri = @"http://wowprogress.com/exports/ranks/" + fileName;
if (!File.Exists(fileName))
{
using (WebClient webClient = new WebClient())
{
webClient.UseDefaultCredentials = true;
webClient.DownloadFile(remoteUri, fileName);
}
}
Am I doing something wrong at all, or can someone point me to a working example?
source
share