2013-01-22 44 views
1

錯誤:System.Reflection.TargetInvocationException:調用的目標引發了異常。 ---> System.Net.WebException:WebClient請求期間發生異常。 ---> System.IO.PathTooLongException:指定的路徑,文件名或這兩者太長。完全限定的文件名必須少於260個字符,且目錄名稱必須少於248個字符。路徑,文件名或兩者都太長。名稱必須少於260個字符,目錄名稱必須少於248個字符

我在這個代碼中使用;

public void Main() 
{ 
    System.Net.WebClient myWebClient = new System.Net.WebClient(); 
    myWebClient.DownloadFile(Dts.Variables[0].Value.ToString(), 
          Dts.Variable[1].Value.ToString()); 
    Dts.TaskResult = (int)ScriptResults.Success; 
} 

其中:

Dts.Variables[0].Value.ToString() == https://secure.f-prot.com/keyportal/cgi-bin/keyportalorder.pl?u=l&p=ooetcetcd&product_id=1&number_of_u=3&type=1&length=a&partner_id=2932&order_ref=4&account_reference_name=audney&account_reference_value=margaretculclagers%sbcglobal.net

Dts.Variables[1].Value.ToString() == C:\Audiney_API_File\keyportal_accountinfo.pl.xml

請幫助我。

+0

參考http://stackoverflow.com/questions/530109/how-to-avoid-system-io-pathtoolongexception –

+1

你確定你已經發布的代碼?我已經嘗試了具有給定值的代碼併成功獲取了xml文件。 – VinayC

回答

1

我的錯誤解決..

根源的:我已經使用了錯誤的變量..

即; (URL,LocalFolder)

我寫過(LocalFolder,URL)。 :) ..

相關問題