I am windows application developer currently am working in a tutorial based application.my application is built in framework 2.0,c#.net ,i have a task that i need to download zip files from azure cloud storage, i know i can simply done this using windows azure nuget package in higher framework but the problem is i can't upgrade the application framework i need to done the task with this framework. can anyone please help me how to solve this, i got a small hint and i tried on that time i got an error "underlying connection was closed". please help me my code
string spath = Application.StartupPath.ToString(); string lPath = spath + "\\EncryptedFiles"; string dTo = Path.Combine(lPath, File); if (System.IO.File.Exists(dTo)) { System.IO.File.Delete(dTo); } NetworkCredential credential = new NetworkCredential("*****", "*****"); CredentialCache cCache = new CredentialCache(); cCache.Add(new Uri(fileName), "Basic", credential);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(delegate { return true; });
WebClient wClient = new WebClient();
wClient.Credentials = cCache;
wClient.DownloadFile(fileName, dTo);