Salve a tutti,
sto scaricando un file di 400Mb con questa routine:
fileStream = new FileStream(strFileDownload, FileMode.Create, FileAccess.ReadWrite);
// Creating an instance of a WebClient
req = new WebClient();
// Creating an instance of a credential cache,
// and passing the username and password to it
CredentialCache cache = new CredentialCache();
cache.Add(new Uri(strDownloadURL), "Basic", new NetworkCredential(strUser, strPWD));
req.Credentials = cache;
Byte[] fileData = req.DownloadData(strDownloadURL);
fileStream.Write(fileData, 0, fileData.Length);
a volte ottengo l'errore: System.OutOfMemoryException
Come posso ovviare al problema?

Rispondi quotando