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
<script>
Window.location(<%=targetUrl%>);
</script>
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 (“www.myserver.com” of https://www.myserver.com/) from what the client has specified.

About these ads

2 Responses 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)


  2. We stumbled over here coming from a different web page and thought I should check things out.
    I like what I see so now i’m following you. Look forward to looking into your web page again.


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: