The remote certificate is invalid according to the validation procedure

Mar 20, 2013 at 2:53 PM
We have a Test Environment where we test out programs and then deploy it in production.
One program utilizes your library (Thanks for that !!!) and runs just fine using the following code:
        using (FTPSClient client = new FTPSClient())
            client.Connect(FTPSite, credential, ESSLSupportMode.CredentialsRequired | ESSLSupportMode.DataChannelRequested, new RemoteCertificateValidationCallback(ValidateTestServerCertificate));
            LSOutput = client.GetDirectoryListUnparsed(FTPFolder);
When the same code was deployed in Production, I got this error:
"The remote certificate is invalid according to the validation procedure"

In Test Region it did not give any certificate error and in Prod it started giving.

So I had to use the logic of accepting all certificates. So It started working fine. But its exceptionally slow. Takes 1 min to connect and another 1 min to retrive Directory listing.

Can you help me debug the issue.