在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { #region 自签名证书,跳过 if (!string.IsNullOrWhiteSpace(certificate.Subject)) { var subjectNames = certificate.Subject.Split(','); foreach (var subjectName in subjectNames) { if (subjectName.Equals("CN=05864111")) { return true; } } } #endregion //合法证书机构的,正常校验 if (errors == SslPolicyErrors.None) return true; return false; }
"CN=05864111" 根据自己实际情况修改。 使用: ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(HttpUtil.CheckValidationResult);
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论