3
Good evening, I need to download a zip file and save to a server, however, with the code I am using below, it just creates the zip file on the server; when opening it, there is no file in it and is given the following message: Unsupported ARCHIVE type.
Inside this zip file, we have two json files. By calling the URL by the browser, it automatically downloads.
var localPath = @"\\nomeServidor\\nomepasta\\" + nomeArquivo;
WebClient webClient = new WebClient();
webClient.DownloadFileAsync(new Uri(link), localPath);
while (webClient.IsBusy) { }
return Request.CreateResponse(HttpStatusCode.OK);
Could someone help me in possible solutions?
Paul, I changed the code, but unfortunately it didn’t work. I am running location on my machine and have access to folder, however it writes an empty zip file.
– T. Borges
Try to require administrator permissions to run your program. To do this, add the following line in your application’s manifest:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

– Paulo Victor
Still nothing.. :/
– T. Borges
What error? could give more information? Can you download the file normally through the browser?
– Paulo Victor
There is no error in the application. By the browser, the file is downloaded normally, with its correct content. By the application, a zip file is created only without content. It might be something related to link permission?
– T. Borges
Paulo, problem solved rsrs It really was the authentication. So beast that you can’t believe kkkkk Thank you!
– T. Borges
It was nothing, can you mark the answer as right? It helps the community :)
– Paulo Victor