How to redirect an http site to use https instead of generating error message

If a user tries to access a website using http and the site is secured for https only, they get an error message:

The Page Must be viewed over a secure channel

The page you are trying to access is secured with Secure Sockts Layer (SSL).

HTTP Error 403.4 - Forbidden: SSL is required to view this resource.

open notepad and create an htm file called "redirect.htm" or something similar. Paste the following into the file:

<SCRIPT type=text/javascript>
<!--if (location.protocol != 'https:'){window.location = 'https://'+ + location.pathname +;//alert( + location.pathname +; Just for sanity check}// -->
open IIS snap-in, click on web site properties, select custom errors tab, and replace 403;4 with the location of the redirection html page you created with the code above.