Thursday, October 12, 2017

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

Exception occured at method XXX-System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

I faced this issues while accessing the site on https and i didn't had the valid certificate. I was trying to connect the sharepoint site through a console application using the CSOM code.

This issue usually come while you don't have the valid certificate.

To solve this proble just add the below line to fix this issue.


ServicePointManager.ServerCertificateValidationCallback = new       
RemoteCertificateValidationCallback
(
   delegate { return true; }
);

Instead of doing this better to use a valid Crtificate

No comments:

Post a Comment