C# 使用web浏览器连接到FTP,以便使用WebClient上载文件。UploadFile:不支持此方法
我的问题很简单。我知道。但无论如何,我无法做到这一点;请看下面的代码。我怎样才能解决这个问题。我怎么了C# 使用web浏览器连接到FTP,以便使用WebClient上载文件。UploadFile:不支持此方法,c#,file-upload,ftp,webclient,C#,File Upload,Ftp,Webclient,我的问题很简单。我知道。但无论如何,我无法做到这一点;请看下面的代码。我怎样才能解决这个问题。我怎么了 System.Net.WebClient webClient = new System.Net.WebClient(); string webAddress = "http://82.21.173.134/Test/"; string destinationFilePath = webAddress + dllName; webClient.Credentials = new System.
System.Net.WebClient webClient = new System.Net.WebClient();
string webAddress = "http://82.21.173.134/Test/";
string destinationFilePath = webAddress + dllName;
webClient.Credentials = new System.Net.NetworkCredential("xxxx", "wR@$xxxx");
webClient.UploadFile("ftp://xxxx@82.21.173.134/Test", "PUT", sourceFilePath);
webClient.Dispose();
错误:{“WebClient请求期间发生异常。”}详细信息:{“不支持此方法。\r\n参数名称:值”}
- 对于FTP协议,您使用的是
,而不是STOR
。最好使用的重载(并暗示相应协议的默认方法)PUT
- 尽管你可能想做一些完全不同的事情。不清楚您对“web浏览器”和
变量(您根本没有使用)的引用是什么意思webAddress
- 对于FTP协议,您使用的是
,而不是STOR
。最好使用的重载(并暗示相应协议的默认方法)PUT
- 尽管你可能想做一些完全不同的事情。不清楚您对“web浏览器”和
变量(您根本没有使用)的引用是什么意思webAddress