I am trying to get the directory list of a FTPS FileZilla server using the code below :
ftpRequest = (FtpWebRequest)FtpWebRequest.Create(host + "/" + directory);
ftpRequest.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateCertificate);
ftpRequest.Credentials = new NetworkCredential(user, pass);
ftpRequest.UseBinary = true;
ftpRequest.UsePassive = true;
ftpRequest.KeepAlive = true;
ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;
ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
I got an exception when FtpWebResponse)ftpRequest.GetResponse()
is executed :
the underlying connection was closed. The server committed a protocol violation.
When I switch to normal FTP connection. Everything works correctly.
Did I miss something to establish this FTPS connection ? thanks for help