Reputation: 797
I've got the following Problem:
I'm developing a Windows 10 Universal App (UAP) in C# and I'm doing network communication via WebRequest
... The Problem is that I want to ignore if the Target Server has an invalid SSL-Certificate. How can I do this? Before Windows 10 I would set the Property in ServicePointManager
, but it is not available in Windows 10... What to do?
Upvotes: 4
Views: 2075
Reputation: 264
Hope this is not too late for you. Was in a similar situation as you. Here is 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");
}
Upvotes: 2