首页 \ 问答 \ 通过C#.Net发送时的SFTP或FTPS(SFTP or FTPS when sending via C#.Net)

通过C#.Net发送时的SFTP或FTPS(SFTP or FTPS when sending via C#.Net)

我读了这篇文章:

这两者彼此非常不同,尽管它们都旨在服务于同一目的。 SFTP使用单个通道发送和接收所有相关数据,而FTPS使用另一个动态决定数据的通道。 FTPS在通过防火墙时经常遇到问题,因为它不知道数据正在使用的端口,并且无法允许通过端口的流量。 FTPS以文本格式发送消息,允许人们读取日志并确定会话期间发生的事情。 SFTP无法做到这一点,因为消息不是文本,而是二进制。

阅读更多:FTPS和SFTP之间的区别| |之间的区别 FTPS与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吗? 我在通过防火墙发送时遇到问题。

谢谢!


I read this article:

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

I didn't want to assume anything as this would just make my job harder if I am wrong but when I am sending a file through C#/.Net4 like this:

  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;

Is that going SFTP or FTPS? I am assuming FTPS as the article indicates due to the EnableSsl.

If it is not SFTP, can I change this to be SFTP instead? I'm having problems sending through a firewall.

Thanks!


原文:https://stackoverflow.com/questions/11436561
更新时间:2022-10-12 14:10

最满意答案

$(document).on('change','.chkView',function(){
var row = $(this).closest('tr');
    if($(this).is(':checked'))
    {           
      $(row).find('.chkEdit,.chkDelete').prop("disabled",false);    
    }
    else
    {
      $(row).find('.chkEdit,.chkDelete').prop("disabled",true);     
    }
});

你错过了'。' 在选择器类中。

演示:

http://jsfiddle.net/J6TN8/2/


$(document).on('change','.chkView',function(){
var row = $(this).closest('tr');
    if($(this).is(':checked'))
    {           
      $(row).find('.chkEdit,.chkDelete').prop("disabled",false);    
    }
    else
    {
      $(row).find('.chkEdit,.chkDelete').prop("disabled",true);     
    }
});

You are missing '.' in the selector class.

Demo:

http://jsfiddle.net/J6TN8/2/

相关问答

更多