My application targets .NET 4.6.1 and I try to use FtpWebRequest
to connect to a FileZilla server using TLS.
However, when the option TLS session resumption is enable, the code below failed with
450 TLS session of data connection has not resumed or the session does not match the control connection
If I disable the option, the code works. What is surprising is that the code worked until we need to reboot the server for update it ! We tried with SSL code using PHP and it works as well when the option is enable.
System.Net.ServicePointManager.ServerCertificateValidationCallback =
New System.Net.Security.RemoteCertificateValidationCallback(
AddressOf myCertificateValidation)
' Set up the request
Dim ftpRequest As System.Net.FtpWebRequest =
CType(System.Net.WebRequest.Create("ftp://myserver.mydomain.eu"),
System.Net.FtpWebRequest)
ftpRequest.EnableSsl = True
ftpRequest.KeepAlive = False
ftpRequest.UsePassive = False
' use the provided credentials
ftpRequest.Credentials = New System.Net.NetworkCredential("MyUser", "MyPwd")
' List the directory content
ftpRequest.Method = System.Net.WebRequestMethods.Ftp.ListDirectoryDetails
' Send the request
Dim ftpResponse As System.Net.FtpWebResponse =
CType(ftpRequest.GetResponse, System.Net.FtpWebResponse)
I tried to set several parameters but it's always the same result.