I'm writing a Web API that calls two different endpoints, both using HTTPS.
One of the endpoints (A) isn't using a proper certificate. Specifically, it's using a cert with a CN of *.foo.bar
but the endpoint I'm connecting to is a.b.foo.bar
. Their in the process of fixing it, but don't have a timeline on how long it will take, and we can't afford to wait for them to fix it to continue our functional testing.
How can I ignore SSL certificate errors when connecting to A, and not when connecting to B?
The current way I've seen it done during my research is to do something like
ServicePointManager.ServerCertificateValidationCallback =
(sender, certificate, chain, errors) => true;
However I don't want to disable it for both endpoints, just A.