Friday, January 28, 2011

403.4 won't redirect in IE7

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?

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

    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...

    WON'T NEVER BREAK ! 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).

    Wanna learn more on asp.net ? Go to Developerit.com

    Developer IT : Damn ! I got caught with my meta tag... Ever tried <meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com"/>
    Developer IT : Forget it I can't paste html so ther's a link http://www.instant-web-site-tools.com/html-redirect.html
  • 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.

    From DerfK

0 comments:

Post a Comment