Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using DownloadFileAsync method of WebClient instance.
It is downloading empty/blank files in case of .dll and .exe extensions but for other files like .rar, txt, msi or zip it is working perfectly fine.

Note: I am downloading file under bin>> Debug/Release folders of the current project

Please suggest why the same method is behaving in a strange manner in case of dll and exe files.

Below are the code snippets:-

clientDownload.Proxy = System.Net.WebProxy.GetDefaultProxy();
clientDownload.Proxy.Credentials = CredentialCache.DefaultCredentials;
clientDownload.Credentials = System.Net.CredentialCache.DefaultCredentials;

clientDownload.DownloadFileAsync(new Uri(file.DownloadUrl+ file.FileName), Path.Combine(tempFolderPath, file.FileFullName));
Posted
Updated 7-May-15 22:49pm
v2

1 solution

Varun

Check the setting for the firewall on your system. That might be causing this.

This method works fine for dll and exes. I have this implemented in my project.
 
Share this answer
 
Comments
Varun Thakur 8-May-15 5:25am    
@Vikram

Firewall service is already in stop state.
vikram_bullet 8-May-15 11:30am    
Can you share more of your code ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900