I want to download a 68kb zip file using webclient and I have the error: C# System.Net.WebException: 'Too many automatic redirections were attempted.'
About this post is a duplicated post: The solution explained in: Why i'm getting exception: Too many automatic redirections were attempted on webclient? Don't work to make my code below works and download the zip file. How Can I edit to explain better ?
My code:
var url_from = "http://www1.caixa.gov.br/listaweb/Lista_imoveis_RJ.zip";
var _to = @"F:\folder\file.zip";
using (var client = new WebClient())
{
client.DownloadFile(url_from, _to);
}
I tried Async ways too but it was generated empty zip file. Like this: How do I download zip file in C#? and this: How can I download a ZIP file from a URL using C#?