网站安全凭证问题

C# 解决网站安全凭证问题

方法一:添加安全凭证

方法二: 添加安全性凭证代码

添加.net安全程序集 

using System.Security.Authentication;

using System.Security.Cryptography.X509Certificates;

添加远程安全返回事件 

private bool CheckValidationResult(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
}

 ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);

此方法必须在创建Url之前 

 

posted @ 2015-11-27 09:55  Crazier  阅读(316)  评论(0编辑  收藏  举报