Does .NET FtpWebRequest Support both Implicit (FTPS) and explicit (FTPES)?

后端 未结 5 1023
忘了有多久
忘了有多久 2020-11-27 05:10

I am being asked to support implicit and explicit FTPS (also known as FTPES). We are currently using the .NET FtpWebRequest. Does the FtpWebRequest

5条回答
  •  不知归路
    2020-11-27 05:38

    .NET Framework/FtpWebRequest supports only explicit TLS/SSL encryption. It does not support implicit TLS/SSL encryption.

    I believe it's unlikely it ever will. The FTP implementation of .NET frameworks uses only standardized features of the protocol. The implicit TLS/SSL encryption was never standardized. It was introduced only as a temporary mechanism to allow using seamless encryption with FTP clients that did not support encryption. In general, there's no reason to use implicit TLS/SSL encryption. An FTP server that supports implicit TLS/SSL encryption only, is broken, imo. Note that RFC 2228 [FTP Security Extensions] was introduced over 20 years ago!


    Anyway, if you need to use the implicit TLS/SSL encryption, you have to use a 3rd party FTP library.

    With WinSCP .NET assembly, it's easy:

    // Set up session options
    SessionOptions sessionOptions = new SessionOptions
    {
        Protocol = Protocol.Ftp,
        UserName = "username",
        Password = "password",
        FtpSecure = FtpSecure.Implicit,
    };
    
    using (Session session = new Session())
    {
        // Connect
        session.Open(sessionOptions);
    
        // Your code
    }
    

    You can have WinSCP GUI generate a C# FTP code template, like the one above, for you.

    (I'm the author of WinSCP)

提交回复
热议问题