2013-03-09 67 views
0

我想使用webclient的DownloadFile功能,但我用断点来查看哪一行O出错。当DownloadFile时,它只是去捕获块。webclient异常已被调用的目标引发

  try 
      { 
       string myStringWebSource = this.curFtpIp + FtpCuPath + "/" + FtpdfName + "/" + this.lbl.Text; 

       WebClient client = new WebClient(); 
       client.Credentials = new NetworkCredential(this.FtpUserID, this.FtpPassword); 
       client.DownloadFile(myStringWebSource, SaveFile); 
      } 
      catch (Exception ex) 
      { MessageBox.Show(ex.Message); } 
      finally { } 
+0

错误是什么样的FACED ?????????? – 2013-03-09 06:37:13

回答

1

我已经解决了我自己的问题。我发现我设置了错误的第二个参数。我只是使用“SaveFile”这是保存路径,但它应该是一个文件名。所以,我只是修改了SaveFile,它可以工作。

WebClient.DownloadFile MSDN

相关问题