Recently , I have question from my client to read Exchange Server Emails , During that process it was throwing me exception of
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel
Everything was as perfect as before : Things are all good , all credentials are working OK , Except One thing – That was self signed SSL certificate used in Exchange Server.
When you call exchange server it makes check for Trusted Root Certificate and if the certificate is not trusted , it throws exception.
To avoid this exception and validate SSL certificate (Source : MSDN) We need to add block of code
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
That will accept all SSL Certificates and let me get through Exchange Server ( I did tried it for Exchange Server 2007 SP1)
Happy Coding !
Recent Comments