The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

Hi,

I am getting the above message when running the following code:

Aspose.Network.License license = new Aspose.Network.License();
license.SetLicense("Aspose.Network.lic");

ExchangeClient client = new ExchangeClient("https://192.168.168.1/exchange/Darren", "user", "password", "myDomain.local");

ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);

I’m using Exchange 2003. Do the Exchange functions work on SSL and on Exchange 2003?

Thanks

Hi,

This error message appears if the Exchange Server has a self signed SSL certificate or it is expired. Please use the following approach to avoid such errors:

// register callback method for SSL validation event in main() or init()


ServicePointManager.ServerCertificateValidationCallback +=
RemoteCertificateValidationHandler;



// this event handler will be called when SSL certificate is
verified


private static bool
RemoteCertificateValidationHandler(
object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)


{


return true; //ignore the checks and go
ahead


}