GA4

Thursday, March 5, 2015

How to ignore SSL certificate when opening a Web Page from your application

I have a scenario where I have to open the web page from the XAML frame window.

The URL was working fine in the browser but when it try to open in a XAML frame i get the following error:

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

To resolve this error, i have to bypass or ignore the check of SSL certificate.

To do so, I have added the following line of code and it did the trick.

ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };

The above code is sometime require to hack the code and to proceed with the developement.

Note : I don't have to add the certificate as we sometine need this type of hacking during development process and not in the production due to environment limitations.

No comments: