Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用web浏览器连接到FTP,以便使用WebClient上载文件。UploadFile:不支持此方法_C#_File Upload_Ftp_Webclient - Fatal编程技术网

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
        变量(您根本没有使用)的引用是什么意思