c# - 带有dll的免费SFTP客户端,用于在C#中上传和下载文件

标签 c# .net ftp client sftp

<分区>

我正在寻找一个免费的 SFTP 客户端。它还应该有一个免费的 dll,我可以使用它编写代码来在 C#(.NET 框架)中上传和下载文件。

例如下面的代码不是免费的,它有 30 天免费评估,我想要免费的,

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.");

最佳答案

我目前正在使用 SharpSSH,它是免费的,而且界面非常简单。 SharpSSH sourcefoge page.它具有您提到的所有身份验证功能。

您可以在 C# 中执行此操作:

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

关于c# - 带有dll的免费SFTP客户端,用于在C#中上传和下载文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3294594/

相关文章:

c# - 触发器中无法识别 Setter TargetName 'ContentPresenter'

c# - 为 Serilog 创建一个包装器

c# - 有没有 "proper"方式读取CSV文件

python - 如何在 python 3 中通过 FTP 发送 StringIO?

coldfusion - 在 ColdFusion CFFTP 中,如果目录不存在,则existsDir 会生成错误

c# - 如何使用 GridView 进行 foreach

c# - .NET Core NuGet 恢复因私有(private) NuGet 提要而失败(VSTS CI 构建)

.net - Java Lucene 与 .Net 集成

C# Winform 尺寸因分辨率降低而减小

FTP数据连接重用