Can connect to FTP using FileZilla or WinSCP, but not with FtpWebRequest or FluentFTP

Solution 1:

.NET framework does not support TLS/SSL session reuse. If your server requires it (what it looks it does and what is quite common nowadays and what is good thing for security), you cannot use FtpWebRequest nor FluentFTP. Both use the .NET implementation of TLS/SSL.

You will have to use FTP library that uses own TLS/SSL implementation.

You can use my WinSCP .NET assembly. Though contrary to FluentFTP, it's not a native .NET library, it has dependencies on an external binary. But that's what makes it working.

Some references:

  • https://github.com/robinrodricks/FluentFTP/issues/347
  • https://github.com/dotnet/runtime/issues/27916
  • "Authentication failed because the remote party has closed the transport stream" when transferring to/from FTP server over TLS/SSL using FluentFTP
  • Upload file to implicit FTPS server in C# with TLS session reuse
  • Suddenly getting "150 Opening Data channel for file download from server" after the FTP downloads was working for years – According to this post and other references elsewhere, the TLS/SSL session reuse was supported earlier with .NET Framework, but some update broke it. In .NET Core it was never working (see also the dotnet GitHub link above).