【问题标题】:No response when using WebClient.UploadFile使用 WebClient.UploadFile 时没有响应
【发布时间】:2012-06-04 08:28:18
【问题描述】:

我正在使用 WebClient 对象上的 UploadFile 方法上传文件。上传文件后,我希望得到确认,根据 MSDN(以及 stackoverflow 上的此处:Should I check the response of WebClient.UploadFile to know if the upload was successful?),我应该能够读取返回的字节数组,但它始终为空。

我做错了什么吗?

WebClient FtpClient = new WebClient();
FtpClient.Credentials = new NetworkCredential("test", "test");
byte[] responseArray = FtpClient.UploadFile("ftp://localhost/Sample.rpt", @"C:\Test\Sample.rpt");
string s = System.Text.Encoding.ASCII.GetString(responseArray);
Console.WriteLine(s); //Empty string

或者不返回异常就一直成功?

【问题讨论】:

    标签: c# ftp webclient


    【解决方案1】:

    对自己的回答:我无法理解,所以我改用 edt ftp (http://www.enterprisedt.com/)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-19
      • 2012-06-25
      • 1970-01-01
      • 1970-01-01
      • 2017-02-22
      相关资源
      最近更新 更多