4
votes

I am working on a phone Windows 10 Universal Application. I am trying to connect to an OAuth server with auto-signed certificate.

When I open a web view to that server I get the error :

"Security certificate required to access this resource is invalid"

I wanted to use the following intstruction but ServicePointManager does not exist on Universal App.

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

Any idea how to bypass ssl validation on these apps ? Thanks.

1
Did you found any success?Rashmin Javiya

1 Answers

6
votes

In Windows Runtime the webview should not ever go to an untrusted page, so you will meet the above exception.
In order to solve your problem, you need to include the Certificates on your UWP app or you have to Ignore SSL Certificate errors.

For how to include the Certificates on your UWP app, you need to add the “Certificate” Declaration to your Package.appxmanifest. enter image description here
For more information, please try to refer to this article: http://blogs.msdn.com/b/wsdevsol/archive/2014/06/05/including-self-signed-certificates-with-your-windows-runtime-based-windows-phone-8-1-apps.aspx

Yes, ServicePointManager is not available in the Windows Runtime app, in order to ignore SSL Certificate errors, we can use the HttpBaseProtocolFilter.IgnorableServerCertificateErrors | ignorableServerCertificateErrors property to help us. For more information, please try to refer to the following two articles:
http://blogs.msdn.com/b/wsdevsol/archive/2013/10/17/how-to-ignore-self-signed-certificate-errors-in-windows-store-apps-8-1.aspx.
https://bernhardelbl.wordpress.com/2013/06/28/ignore-ssl-certificate-errors-in-windows-8-1-apps/.