我读了这篇文章:
The two are very different from each other, although they both aim to serve the same purpose. SFTP uses a single channel to transmit and receive all the pertinent data, while FTPS uses another channel that is dynamically decided for the data. FTPS often had problems when passing through a firewall, as it did not know the port that was being used by the data, and failed to allow traffic through the port. FTPS sends messages in a text format, allowing people to read logs and determine what happened during the session. This is not possible with SFTP, as the messages are not in text, but in binary.
Read more: Difference Between FTPS and SFTP | Difference Between | FTPS vs SFTP http://www.differencebetween.net/technology/internet/difference-between-ftps-and-sftp/#ixzz20KUGWr00
我不想假设任何事情,因为如果我错了,这只会让我的工作变得更加困难,但是当我通过 C#/.Net4 发送文件时,如下所示:
var request = (FtpWebRequest) WebRequest.Create(FtpUrl + filename);
request.Method = WebRequestMethods.Ftp.UploadFile;
var secureString = new SecureString();
foreach (var b in Encoding.Default.GetBytes(FtpPassword))
secureString.AppendChar((char) b);
request.Credentials = new NetworkCredential(FtpUsername, secureString);
request.EnableSsl = true;
那是 SFTP 还是 FTPS?由于 EnableSsl,我假设 FTPS 如文章所述。
如果不是 SFTP,我可以将其更改为 SFTP 吗?我在通过防火墙发送时遇到问题。
谢谢!
最佳答案
SFTP 是使用 SSH 传输文件。如果您在远程计算机上运行 ssh,则可以将其更改为此。我不确定 C# 是否支持它。根据这个:http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/817b4f71-7e88-4b62-b48a-8a5edca800fd/答案是否定的。
FTPS 正在将 SSL 添加到 FTP。有点像 HTTPS 是 HTTP 之上的 SSL。
您的代码肯定使用了 FTPS。
您的防火墙问题可能在此处解释:http://en.wikipedia.org/wiki/Ftps#Firewall_incompatibilities
关于c# - 通过 C#.Net 发送时的 SFTP 或 FTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11436561/