C# Ignore certificate errors?

后端 未结 11 1163
鱼传尺愫
鱼传尺愫 2020-11-22 15:01

I am getting the following error during a web service request to a remote web service:

Could not establish trust relationship for the SSL/TLS secure c

11条回答
  •  庸人自扰
    2020-11-22 15:34

    Bypass SSL Certificate....

            HttpClientHandler clientHandler = new HttpClientHandler();
            clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
    
            // Pass the handler to httpclient(from you are calling api)
            var client = new HttpClient(clientHandler)
    

提交回复
热议问题