本文介绍了使用WebClient的DownloadFileAsync方法加载空dll和exe文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WebClient实例的 DownloadFileAsync 方法。

在.dll和.exe扩展名的情况下下载空/空文件 但对于其他文件,如.rar,txt,msi或zip,它工作得很好。



注意:我正在下载bin下的文件>>当前项目的调试/释放文件夹



请说明为什么同样的方法在dll和exe文件的情况下表现得很奇怪。 />


以下是代码片段: -



clientDownload.Proxy = System。 Net.WebProxy.GetDefaultProxy();

clientDownload.Proxy.Credentials = CredentialCache.DefaultCredentials;

clientDownload.C​​redentials = System.Net.CredentialCache.DefaultCredentials;



clientDownload.DownloadFileAsync(new Uri(file.DownloadUrl + file.FileName),Path.Combine(tempFolderPath,file.FileFullName));

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

推荐答案


这篇关于使用WebClient的DownloadFileAsync方法加载空dll和exe文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 20:56