webservice双向验证

        ServicePointManager.Expect100Continue = true;
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
        System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
        System.Net.ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult);

        //证书文件路径
        string filePath = "client.p12";
        X509Certificate2 cert = new System.Security.Cryptography.X509Certificates.X509Certificate2(filePath, "123456");

        this.ClientCertificates.Add(cert);

  

posted @ 2018-09-28 11:53  HandsomeBoy  阅读(310)  评论(0编辑  收藏  举报