469,926 Members | 1,524 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

Trying to Redirect from https to http (secure to non secure)


I have a problem with a server side redirect from a secure page to a
non-secure page (same domain name, same folder)

I have added some test code that can display the target URL and that
containt http:// and yet it redirects to https://

I am on
enter username+password into a form; page posts back to itself, then
calls my function for redirection to non secure pages:


this executes
Response.Redirect "http://www.example.com/test/files/myaccount.asp"

but the browser goes to

Any ideas why this happens?

I suspect this has to do with a cookie that persists user/pwd info,
could that force the client to go to the Secure page?

thanks in advance

See my relevant code below:

Function stripSSL(sTarget)
Dim host
Dim sUrl
Dim i
if sTarget="" Then Exit Function

host=Request.ServerVariables("server_name") '

sTarget=" & sTarget
i=InStrRev(sUrl, "/")
stripSSL= "http://" & host & Left(sUrl,i) & sTarget
End Function

Function redirectNoSSL(sUrl)
Dim sNewURL
sNewURL = stripSSL(sUrl)
If False Then ' Print link instead of redirect
Response.Write "<BODY>TEST: Redirect to stripSSL (" & sUrl & ") =
<a href=" & sNewURL & ">" & sNewURL & "</a>"
Response.Write "<BR>ServerVariables(HTTPS)=" &
Request.ServerVariables("HTTPS") & "</BODY>"
Response.Redirect sNewURL
End If
End Function
Nov 7 '08 #1
0 4014

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sergej Prokoviev | last post: by
7 posts views Thread by =?Utf-8?B?YzY3NjIyOA==?= | last post: by
2 posts views Thread by RuthC | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.