WebClient + HTTPS Issues

前端 未结 3 1427
既然无缘
既然无缘 2020-12-02 13:54

I am currently integrating with a system created by a 3rd party. This system requires me to send a request using XML/HTTPS. The 3rd party send me the certificate and I insta

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-02 14:38

    The shortest notation of the code to allow all certificates is actually:

    ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
    

    And works well for this error. Needless to say that you should provide an implementation which actually checks the certificate and decides based on the certificate information if the communication is safe. For test purposes, use the above line of code.

提交回复
热议问题