D
daveh42
Hi,
We want to upload a file to a business partner using FTP with SSL from our
intranet. Our proof of concept solution in VB uses FtpWebRequest based on an
example at http://www.123aspx.com/redir.aspx?res=34336:
Dim reqObj As FtpWebRequest =
WebRequest.Create("ftp://ftps.example.com:1742/123456789_12-31-2007")
reqObj.EnableSsl = True
reqObj.UsePassive = True
reqObj.Method = WebRequestMethods.Ftp.UploadFile
reqObj.Credentials = New NetworkCredential("username", "password")
Dim streamObj As FileStream = File.OpenRead("D:\Files\123456789_12-31-2007")
Dim buffer(streamObj.Length) As Byte
streamObj.Read(buffer, 0, buffer.Length)
streamObj.Close()
streamObj = Nothing
Dim reqStream As Stream
reqStream = reqObj.GetRequestStream()
reqStream.Write(buffer, 0, buffer.Length)
reqStream.Close()
reqStream = Nothing
reqObj = Nothing
We are getting the error "Unable to connect to the remote server" on the
"reqStream = reqObj.GetRequestStream()" line. The username and password are
correct. What should we check next?
Thanks,
Dave
We want to upload a file to a business partner using FTP with SSL from our
intranet. Our proof of concept solution in VB uses FtpWebRequest based on an
example at http://www.123aspx.com/redir.aspx?res=34336:
Dim reqObj As FtpWebRequest =
WebRequest.Create("ftp://ftps.example.com:1742/123456789_12-31-2007")
reqObj.EnableSsl = True
reqObj.UsePassive = True
reqObj.Method = WebRequestMethods.Ftp.UploadFile
reqObj.Credentials = New NetworkCredential("username", "password")
Dim streamObj As FileStream = File.OpenRead("D:\Files\123456789_12-31-2007")
Dim buffer(streamObj.Length) As Byte
streamObj.Read(buffer, 0, buffer.Length)
streamObj.Close()
streamObj = Nothing
Dim reqStream As Stream
reqStream = reqObj.GetRequestStream()
reqStream.Write(buffer, 0, buffer.Length)
reqStream.Close()
reqStream = Nothing
reqObj = Nothing
We are getting the error "Unable to connect to the remote server" on the
"reqStream = reqObj.GetRequestStream()" line. The username and password are
correct. What should we check next?
Thanks,
Dave