title: FTP Connection from SSIS Script task
body: <p>I am trying to download files from an FTP server using a SSIS Script task, I am using the class 'ftpClientConnection' class and in it tried using the 'ReceiveFiles' method to download files from the FTP location to my local folder. But I am getting some exception error, when I debugged the Script task I find that the exception occurs in the 'ftp.connect()' line. I have passed all the required arguments while creating the object for 'ftpClientConnection'. To debug in an other way I simply tried using the FTP task, even here I am getting an error of "Connection cannot be established". FYI I am able to log in to the FTP location with the service credentials that I am provided in both my script task and FTP task. </p>
  
  <p>PS: I am new to VB.net</p>
  
  <p>Code Here</p>
  
  <pre><code>    Dim cm As ConnectionManager = Dts.Connections.Add("FTP")
  
      'Set the properties like username &amp; password
  
      cm.Properties("ServerName").SetValue(cm, "ftp://&lt;ftpname&gt;/")
  
      cm.Properties("ServerUserName").SetValue(cm, "&lt;username&gt;")
  
      cm.Properties("ServerPassword").SetValue(cm, "&lt;password&gt;")
  
      cm.Properties("ServerPort").SetValue(cm, "21")
  
      cm.Properties("Timeout").SetValue(cm, "0") 
  
      cm.Properties("ChunkSize").SetValue(cm, "1000")
  
      cm.Properties("Retries").SetValue(cm, "1")
  
  
      Dim ftp As FtpClientConnection = New FtpClientConnection(cm.AcquireConnection(Nothing))
  
  
      ftp.Connect()
  
      Dim remotefilenames() As String = {"&lt;ftpfolder/filename.txt&gt;"}
  
      Dim localpath As String = "&lt;C:\localfolder\FTPDestination\&gt;"
  
      'Build a array of all the file names that is going to be downloaded (in this case only one file)
  
      ftp.ReceiveFiles(remotefilenames, localpath, True, True)
  
      ftp.Close()
  </code></pre>
  
  <p>I am getting an excpetion right at the "ftp.connect()" line</p>