Accessing the ServicePoint with WebRequestHandler

Topics: Web Api
Feb 10, 2012 at 3:06 PM


I've a HTTPS-based scenario where the client must access the server certificate used on the TLS connection.

Using HttpWebRequest, I have access to the underlying ServicePoint, namely the Certificate property. However, using WebRequestHandler there doesn't seem to be a way to obtain such information.



Feb 10, 2012 at 4:01 PM

You can always access the underlying ServicePoint with ServicePointManager.FindServicePoint(uri).  That said, the Certificate property is highly transitive (if you're submitting multiple requests) and therefor unreliable.  The best way to look at server certificates is with ServicePointManager.ServerCertificateValidationCallback.