如何在web.config中设置ServicePointManager.ServerCertificateValidationCallback

时间:2014-12-02 06:37:09

标签: c#

如何在web.config文件中设置

ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) =>true;

1 个答案:

答案 0 :(得分:2)

试试这个;

Global.asax Application_Start 中编写代码。

它应该工作.. !!!

在配置文件中;

<configuration>
 <system.net>
   <settings>
     <servicePointManager
        checkCertificateName="false"
        checkCertificateRevocationList="false"         
     />
  </settings>
</system.net>
</configuration> 

您也可以访问MSDN