Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a secured folder that requires SSL. I have set it up in IIS(6) to require SSL. We don't want the visitors to be greeted with the "must be secure connection" error, so I have modified the 403.4 error page to contain the following:

<script type="text/javascript">
function redirectToHttps()    {

    var httpURL = window.location.hostname+window.location.pathname;

    var httpsURL = "https://" + httpURL ;

    window.location = httpsURL ;

}
redirectToHttps();
</script>

And this solution works great for every browser, but IE7. On any other browser, if you type in http://www.mysite.com/securedfolder it will automatically redirect you to https://www.mysite.com/securedfolder with no message or anything (the intended action). But in Internet Explorer 7 ONLY it will bring up a page that says

The website declined to show this webpage
Most Likely Causes:
This website requires you to log in

This is something we don't want of course. I have verified that javascript is enabled, and the security settings have no effect, even when I set them to the lowest level I get the same error.

I'm wondering, has anyone else seen this before?

share|improve this question
add comment

2 Answers 2

My guess is that IE's "Friendly Error Message" feature is replacing your error page with one it thinks is easier for people to understand. According to this kb article, the "friendly error message" is not used when the server response is large enough, and suggests padding your custom error page with spaces until it is.

share|improve this answer
add comment

I never experience it before, but, i wonder why you use javascript to do it ? Ever tried with the

<meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com"> ?

The way I deal with this problem was easy, since I use ASP.NET. You make an abstract page class or HttpModule (entire web app) that check if (!Request.IsSecure) ... redirect with a 301 to secure page.

This nice thing about doing it server-side is that it will work without javascript. I'm pretty sure you can do the same in any language (Java, PHP, ruby even c++ if you're old school).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.