Pregunta

Estoy tratando de descargar un documento con este código:

 using (Impersonator impersonator = new Impersonator())
 {
     siteURL += "?NoRedirect=true";
     System.Net.WebClient _WebClient = new System.Net.WebClient();
     // Downloads the resource with the specified URI to a local file.
     _WebClient.DownloadFile(siteURL, saveName);
 }

pero recibo un error 401 Acceso inoperante.¿Tienes alguna idea de dónde viene? Gracias

¿Fue útil?

Solución

Intenta agregar:

_WebClient.Credentials = CredentialCache.DefaultCredentials;

Licenciado bajo: CC-BY-SA con atribución
scroll top