downloadfile不会将文件下载到客户端计算机

downloadfile不会将文件下载到客户端计算机

本文介绍了webclient.downloadfile不会将文件下载到客户端计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在创建一个网络应用程序,允许用户从服务器下载文件并将其保存到本地计算机,这是我的代码下载文件。

 使用(WebClient client =  new  WebClient())
{
Uri srcPath = new Uri(urlString);

client.DownloadFile(srcPath,destPath);

}





srcPath是服务器的路径,目标路径是路径文件将下载到客户端计算机。我总是得到一条路径无法识别的错误。当我将destPath更改为C:\时,它会下载文件而不是本地机器,而是下载到服务器的驱动器C:..我一直在对此进行一些研究,但找不到文章或描述相同问题的解决方案。非常感谢您的帮助。



谢谢,

解决方案



Hi,

I am creating a web app that will allow users to download files from the server and save it to their local machine, Here is my code for downloading the files.

using (WebClient client = new WebClient())
                        {
                            Uri srcPath= new Uri(urlString);

                            client.DownloadFile(srcPath,destPath);

                        }



The srcPath is the path from the server, and the destination path is the path where the files will be downloaded to the client machine. I always get an error that path is not recognized. And when I change the destPath to just "C:\" it downloads the files but not the the local machine, but to the server's drive C: .. I have been doing some research on this and can't find an article or solution that describes the same problem. You help is greatly appreciated.

Thanks,

解决方案



这篇关于webclient.downloadfile不会将文件下载到客户端计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 07:39