Search code examples
javascriptasp.netsecurityswitch

Nuget's Security Switch shows blank javascript page before redirect


So I set up the Nuget plugin Security Switch 4.4.0 on my ASP.NET 4.5 site to set some pages as https and others as http. This all works except that when switching between https pages and http pages there is a second where a blank white page is displayed with one line of javascript, before the redirect completes and the new page loads.

That javascript:

<html><head><title></title><script language="javascript">window.location = 'https://my-site.com/email-newsletter/';</script </head><body></body></html>

I see it is using the js to redirect the page but I'd really like if it didn't show this to the user. Is there any way to remove this effect?


Solution

  • You can add a setting to the securitySwitch configuration element that will remove this feature. This feature is disabled by default, so it sounds like you have this attribute explicitly set to "true" now. Changing it to "false" will likely result in most browsers warning users of the switch from HTTPS to HTTP. There's not much else to do about it without the JS trick.

    <securitySwitch bypassSecurityWarning="false">
    

    Most browsers don't show the blank page you're seeing. Which browser(s) are you seeing this behavior with?