zoukankan      html  css  js  c++  java
  • 应对https协议的下载方式

    在请求下函数前面加一句这样的话,就可以实行对https协议的网站进行下载。
    ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);

     

     


       
    public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
             { 
    // Always accept
                 Console.WriteLine("accept" + certificate.GetName());
                 
    return true//总是接受
             } 
        public class AcceptAllCertificatePolicy : ICertificatePolicy
        {

            
    public AcceptAllCertificatePolicy()
            {

                
    //

                
    // TODO: Add constructor logic here

                
    //

            }

            
    public bool CheckValidationResult(ServicePoint sPoint,

            X509Certificate cert, WebRequest wRequest, 
    int certProb)
            {

                
    // Always accept

                
    return true;

            }

        }
  • 相关阅读:
    devops
    classloader
    webpack之个人理解
    java map
    前端性能资料
    kibana使用的lucene查询语法
    【转】关于JVM CPU资源占用过高的问题排查
    netstat命令
    使用LR11录制手机脚本
    jemeter逻辑控制器
  • 原文地址:https://www.cnblogs.com/chenli0513/p/2036277.html
Copyright © 2011-2022 走看看