开发者

Free SFTP client with dll to upload and download file in C# [closed]

开发者 https://www.devze.com 2023-01-08 16:25 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, poll开发者_如何学编程ing, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago.

I am looking for a SFTP Client which is free. Also it should have a free dll using which I can write code to upload and download file in C# (.NET framework).

For example following code is not free, it has 30 days free evaluation, I want it for free,

Chilkat.SFtp sftp = new Chilkat.SFtp();

bool success;
success = sftp.UnlockComponent("Anything for 30-day trial");

sftp.ConnectTimeoutMs = 5000;
sftp.IdleTimeoutMs = 10000;

int port;
string hostname;
hostname = "www.my-ssh-server.com";
port = 22;
success = sftp.Connect(hostname,port);

success = sftp.AuthenticatePw("myLogin","myPassword");

success = sftp.InitializeSftp();

string handle;
handle = sftp.OpenFile("hamlet.xml","readOnly","openExisting");

success = sftp.DownloadFile(handle,"c:/temp/hamlet.xml");

success = sftp.CloseHandle(handle);
MessageBox.Show("Success.");


I'm currently using SharpSSH which is free and has a very nice easy interface. SharpSSH sourcefoge page. It has all the authentication functionality that you mentioned.

You can do this in C#:

var sftp = new Sftp(hostName, userName, password);
sftp.Connect(port);
sftp.Put(putFilePath, toDir);
sftp.Get(getFilePath);


Would recomend to take a look at https://nuget.org/packages/SSH.NET

I think it's more up to date than sharp.ssh, works good for transmitting files through sftp.


You might want to take a look at WinSCP. Although it is not a library, you can write scripts to drive it and the link is to a nice tutorial that shows you how to do it in both C# and Visual Basic.

0

精彩评论

暂无评论...
验证码 换一张
取 消