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.

Resolution:
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.host + location.pathname + location.search;//alert(location.host + location.pathname + location.search); Just for sanity check}// -->
</SCRIPT>
---------------
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.