sidwelle
asked on
.net Sftp request.EnableSsl
Looking for a code snip that will retrieve a file and dir listing from a SFTP server.
Found a couple of examples on-line look promising but keep getting an error:
"System.Net.WebException: The remote server returned an error: 234 SSL enabled... start negotiation . ---> System.IO.IOException: The handshake failed due to an unexpected packet format. ..."
Any help is appreciated.
Found a couple of examples on-line look promising but keep getting an error:
"System.Net.WebException: The remote server returned an error: 234 SSL enabled... start negotiation . ---> System.IO.IOException: The handshake failed due to an unexpected packet format. ..."
Dim request As System.Net.FtpWebRequest = DirectCast(WebRequest.Create(New Uri("ftp://sftp.domain.com/myFile.txt")), System.Net.FtpWebRequest)
request.Method = WebRequestMethods.Ftp.DownloadFile
request.EnableSsl = True
request.Credentials = New Net.NetworkCredential("username", "password")
request.UsePassive = True
Dim response As System.Net.FtpWebResponse = DirectCast(request.GetResponse(), System.Net.FtpWebResponse)
Any help is appreciated.
SFTP uses SSH, not SSL/TLS. They are not the same or even compatible encryption methods. You will have to find an SSH/SFTP library to make that connection.
ASKER
I see a lot of examples using the "SharpSSH" library, are there any others ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dazve, thanks for the help.