Monday, February 9, 2015

How to ignore a certificate error - without the certificate



Hi Friends,

If you getting error like "Could not establish trust relationship for the SSL/TLS secure channel".

Do following two things

1) Add using System.Net; at your class

2) Add below line before calling your service method
 
ServicePointManager.ServerCertificateValidationCallback += 
(sender, cert, chain, sslPolicyErrors) => true;
 
 
The above line returning true will allow ignoring the validation error.

No comments:

Post a Comment