Ignore invalid Windows 10 SSL certificate
I have the following problem:
I am developing a Windows 10 Universal Application (UAP) in C # and I am doing network communication via WebRequest
... The problem is that I want to ignore if the wrong SSL certificate is installed on the target server. How can i do this? Before Windows 10, I would set the property to ServicePointManager
, but it is not available in Windows 10 ... What should I do?
+3
source to share
1 answer
Hope it's not too late for you. Was in the same situation as you. Here's what I did.
var filter = new Windows.Web.Http.Filters.HttpBaseProtocolFilter();
filter.IgnorableServerCertificateErrors.Add(Windows.Security.Cryptography.Certificates.ChainValidationResult.Expired);
filter.IgnorableServerCertificateErrors.Add(Windows.Security.Cryptography.Certificates.ChainValidationResult.Untrusted);
filter.IgnorableServerCertificateErrors.Add(Windows.Security.Cryptography.Certificates.ChainValidationResult.InvalidName);
using (var client = new Windows.Web.Http.HttpClient(filter))
{
Uri uri = new Uri("https://yourwebsite.com");
}
+2
source to share