We help IT Professionals succeed at work.

Catch SSL cert request error so as to redirect to the correct site

kw66722 asked
using ASP.Net, When users make secure page requests using

the user gets an error:


Error code: ssl error bad cert domain
The certificate was issued to www.somesite.com and indicates that somesite.com uses an invalid security certificate.

I was hoping to be able to catch the request in the Application BeginRequest event but the SSL error occurs before this. In order to invoke the Application BeginRequest event the user needs to click through the certificate error message. Is it possible to redirect in code so the error will not be received?
Watch Question

Top Expert 2004

As far as I know, that is a client-side condition, and it is not exposed to the server.

My understanding is that the redirect would not be sent until after the HTTPS connection is made, and the SSL certificate is in play:



is there a way to do it on the certificate then?
Top Expert 2004
What is invalid about the current certificate?  Many modern CAs issue certificates that match both www.domain.com and domain.com.  Perhaps purchasing the certificate from a different CA will resolve the issue.

In any case, that is the basics of the solution here - fix whatever is wrong with the certificate.  You will not be able to intercept how the client reacts to the certificate during the handshake process.