Getting around “You are being redirected to an unsecure site”

August 29, 2006

Doing a response.redirect from a HTTPS page to HTTP page is not considered good as the users get this warning “you are being redirected to an unsecure site”.
The one way which I have used to avoid this warning is to tell a client side javascript to do the redirect.
i.e. if I want to go from https://myserver/a.aspx to http://myserver/b.aspx, I do the following
From a.aspx, i do a response.redirect to https://myserver/redirect.aspx?targeturl=http://myserver/b.aspx
Then by using a javascript on redirect.aspx, i make a page on load javascript method to call something like
this makes the client browser move to the http page.
While coding such redirect – you may want to consider that the deployment of the application may be done on different environments with different server URLs. Hence you may want to read the hostname (“” of from what the client has specified.


One Response to “Getting around “You are being redirected to an unsecure site””

  1. Eduardo Says:

    I am a newbie about programming, but was wondering if you know how to do that in PHP?

    I have a site that just calls PHP includes and one of those includes has a secure form.

    In my index.php, however, I am trying to load a JavaScript (just for looks – GreyBox) so when the include where my secure form is loaded I get the warning you mention.

    Is there a way around this? (in PHP)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: