不支持 webclient uri 格式

Rah*_*hul 1 asp.net wcf c#-4.0

WebClient fileReader = new WebClient();
fileAddress = listItem;    

//error here uri formats are not supported
fileReader.DownloadFile(fileAddress, saveTo);
Run Code Online (Sandbox Code Playgroud)

这里是文件地址地址即将到来

http://pcdev04.pcsolution.net:83\Update32\rts\RTSUpdate.dll
Run Code Online (Sandbox Code Playgroud)

Dar*_*rov 5

您需要在 URI 字符串中替换\/才能获得有效的地址:

fileReader.DownloadFile(fileAddress.Replace("\\", "/"), saveTo);
Run Code Online (Sandbox Code Playgroud)