Domanda

Sto cercando di scaricare un documento con questo codice:

 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);
 }
.

Ma ottengo un errore 401 accesso unica.Hai qualche idea da dove provenga? Grazie

È stato utile?

Soluzione

Prova ad aggiungere:

_WebClient.Credentials = CredentialCache.DefaultCredentials;
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top