views:

468

answers:

2

How do i check the client browser SSL certificate in my ASP.net code behind I want to ensure that if any https proxy like fiddler is running then my application does not load I have done the following till now without any success: My site is on Https In IIS i have set Require SSL= true Require 128 bit encryption =true accept certificate = true

in my default.aspx Page_Load i am trying to read the value of Request.ClientCertificate, the collection is coming as empty.

A: 

Are you expecting the client to have a certificate installed? Most users do not have client certificates installed.

Nonetheless, I'm not sure how exactly a client certificate is going to protect you in the situation you describe...

binarycoder
Thanks for the replyIam not expecting a client to have certificate installed I intent to validate the SSL that get loaded in the browser using the CA of the cert
John
+1  A: 

There is no way to do what you're trying to do unless you run an ActiveX control on the client.

Internet Explorer and other browsers do not expose the server's SSL certificate information to the JavaScript in the page, meaning that there's no way for your page, running on the client, to know whether or not it was delivered with your certificate or another certificate.

Having said that, even if such a method was offered, it probably wouldn't help you anyway. Presumably, you want to do this to prevent viewing/modification of your traffic, but there are other tools that plug into the browser directly (post HTTPS-decryption, pre HTTPS-encryption) that can view/modify traffic without resigning it as Fiddler and other proxies do.

Furthermore, your code would fail in corporate environments where the edge proxy (e.g. BlueCoat, Forefront) does content-inspection using the same mechanisms that Fiddler uses.

EricLaw -MSFT-