忽略无效的SSL证书- Windows 10

4

我有以下问题:
我正在使用C#开发Windows 10通用应用程序(UAP),并通过WebRequest进行网络通信...问题是我想忽略目标服务器是否有无效的SSL证书。我该怎么办?在Windows 10之前,我会在ServicePointManager中设置属性,但在Windows 10中不可用...应该怎么做?


你找到解决方案了吗? - Julien Coqueret
不,我现在正在使用http... - Luca Schimweg
1个回答

2

希望现在还不算太晚。我曾经也遇到过类似的情况,以下是我的做法。

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");
    }

这就是我最终的做法! - Luca Schimweg

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接