2013-03-09 54 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