I am using the System.Net.FtpClient and I an trying to connect to a server (don't have access to the code in server). when I connect using Winscp/Filezile I succeeded to connect. however when I am using C# I am getting this exception:" 'The remote certificate is invalid according to the validation procedure.'"
not sure what am I doing wrong attaching my code and a photo when I connect using filezila
System.Net.FtpClient.FtpClient _ftpClient = new System.Net.FtpClient.FtpClient();
_ftpClient.Host = Host;
_ftpClient.Port = 990;
_ftpClient.Credentials = new System.Net.NetworkCredential(UserName, Password);
_ftpClient.SslProtocols = System.Security.Authentication.SslProtocols.Tls;
_ftpClient.EncryptionMode = System.Net.FtpClient.FtpEncryptionMode.Explicit;
_ftpClient.Connect();
Implementation is the same as fluent ftp:
_ftpClient.ValidateCertificate +=
_ftpClient_ValidateCertificate1;
private static void
_ftpClient_ValidateCertificate(System.Net.FtpClient.FtpClient
control, System.Net.FtpClient.FtpSslValidationEventArgs e)
{
e.Accept = true;
}