mesican
asked on
SFTP in vb.net
Is there a .NET class for SFTP (secure file transfer protocol)? I want to use vb.net to make a sftp conncetion but I cant find any information on it. Any suggestions?
i use http://www.xceedsoft.com/products/FtpLib/index.aspx
ASKER
Ya that cost $299.95. I found a way to do it for free though. You can use http://winscp.net/eng/index.php for SFTP. It has a great comand prompt for scripting and its free
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
.NET Framework does not include SFTP support. You have to try a third party component. There is at least one free (called tamirgal) and a few commercial. Following code is taken from samples of Rebex SFTP for .NET (http://www.rebex.net/sftp.net/)
https://www.rebex.net/sftp.net/tutorial-sftp.aspx#upload-download
'create client, connect and log in
Dim client As New SFtp
client.Connect("sftp.example.org")
client.Login("username", "password")
' upload the 'test.zip' file to the current directory at the server
client.PutFile("c:\data\te st.zip", "test.zip")
' upload the 'index.html' file to the specified directory at the server
client.PutFile("c:\data\in dex.html", "/wwwroot/index.html")
' download the 'test.zip' file from the current directory at the server
client.GetFile("test.zip", "c:\data\test.zip")
' download the 'index.html' file from the specified directory at the server
client.GetFile("/wwwroot/i ndex.html" , "c:\data\index.html")
' upload a text using a MemoryStream
Dim message As String = "Hello from Rebex SFTP for .NET!"
Dim data As Byte() = System.Text.Encoding.Defau lt.GetByte s(message)
Dim ms As New System.IO.MemoryStream(dat a)
client.PutFile(ms, "message.txt")
https://www.rebex.net/sftp.net/tutorial-sftp.aspx#upload-download
'create client, connect and log in
Dim client As New SFtp
client.Connect("sftp.example.org")
client.Login("username", "password")
' upload the 'test.zip' file to the current directory at the server
client.PutFile("c:\data\te
' upload the 'index.html' file to the specified directory at the server
client.PutFile("c:\data\in
' download the 'test.zip' file from the current directory at the server
client.GetFile("test.zip",
' download the 'index.html' file from the specified directory at the server
client.GetFile("/wwwroot/i
' upload a text using a MemoryStream
Dim message As String = "Hello from Rebex SFTP for .NET!"
Dim data As Byte() = System.Text.Encoding.Defau
Dim ms As New System.IO.MemoryStream(dat
client.PutFile(ms, "message.txt")
Just for further details, there's a guide with VB.Net example for using WinSCP:
http://winscp.net/eng/docs/guide_dotnet
http://winscp.net/eng/docs/guide_dotnet