I want to upload and download a file to FTP over ssl with custom port number or FTP with implicit SSL. I am using .net ftpwebrequest & ftpwebresponse method for this. here is my code:
Dim reqObj As FtpWebRequest = CType(WebRequest.Create(_Url + filename), FtpWebRequest)
reqObj.Method = WebRequestMethods.Ftp.UploadFile
reqObj.KeepAlive = False
If _IsSSLEnable Then
reqObj.UseBinary = True
End If
reqObj.Credentials = New NetworkCredential(_UserName, _Password)
If _IsSSLEnable Then
reqObj.EnableSsl = _IsSSLEnable Net.ServicePointManager.ServerCertificateValidationCallback = AddressOf validateCert
End If
Dim streamResponse As Stream
streamResponse = reqObj.GetRequestStream()
I am getting error after this...
The server returned an address in response to the PASV command that is different than the address to which the FTP connection was made.
But if i Add
reqObj.UsePassive = False
It gives me error:
The operation has timed out
this is working fine for normal ftp and ftp over ssl but not for custom port number or implicit ssl.
Can you please tell me does .net support this?
Or I have to use other method for this case
Thanks,
Hemant