1

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.WebException: An exception occurred during a WebClient request. ---> System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

I'm using this code in ;

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;
}

where:

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

Kindly help me .

Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443
  • refer http://stackoverflow.com/questions/530109/how-to-avoid-system-io-pathtoolongexception – Satinder singh Jan 22 '13 at 09:19
  • 1
    Are you sure about the code that you have posted? I have tried the code with given values and got the xml file successfully. – VinayC Jan 22 '13 at 09:30

1 Answers1

1

My Error is Resolved ..

Root cause's : I have used wrong variable ..

i.e; Instead of writing like this (URL,LocalFolder )

I have written (LocalFolder,URL). :)..

Sankar Ganesh PMP
  • 11,927
  • 11
  • 57
  • 90