aspx.net 调用远程服务遇到此问题,网上找方法,觉得这个比较简便,拿来一试,不报标题的错误了。但是服务返回的是null,先将方法保存下来与诸位共同学习。
链接地址:http://www.dotblogs.com.tw/rainmaker/archive/2010/11/30/19803.aspx
void Application_Start()
{
System.Net.ServicePointManager.ServerCertificateValidationCallback =new System.Net.Security.RemoteCertificateValidationCallback(
delegate(object MySender,System.Security.Cryptography.X509Certificates.X509Certificate MyCertificate,
System.Security.Cryptography.X509Certificates.X509Chain MyChain,System.Net.Security.SslPolicyErrors MyErrors)
{
if (MySender is System.Net.WebRequest)
{
//忽略凭证检查,一律回传true
return true;
}
return false;
});
}