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