Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Cannot connect to a FTPS(SSL/TLS) server

$
0
0

Hello all. I have spent a day long trying to figure out why I could not connect to a FTPS server but to no avail. I always got this error.

System.Security.Authentication.AuthenticationException
a call to SSPI failed, see inner exception

I set up a connection in FileZilla, with protocal=FTP and encription=any of the three TLS choices. It works well. I can download, upload and delete files in the server. But it just doesn't work with C# code.

Does anyone have any ideas ?

public bool CheckConnection(string RemoteHost, string UserName, string Password)
{
     try
     {
        FtpWebRequest request = (FtpWebRequest)WebRequest.Create(RemoteHost);
        request.EnableSsl = true;
        request.Method = WebRequestMethods.Ftp.ListDirectory;
        request.Credentials = new NetworkCredential(UserName, Password);             
        request.GetResponse();
      }
        catch (WebException ex)
      {
         MessageBox.Show("Fail:" + ex.ToString());
          return false;
      }
       return true;
}




Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>