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

Discussion in 'ASP General' started by Raven, Nov 7, 2008.

  1. Raven

    Raven Guest

    Hi,

    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://
    example:

    I am on
    https://www.example.com/test/files/login.asp?Cmd=logout
    enter username+password into a form; page posts back to itself, then
    calls my function for redirection to non secure pages:

    redirectNoSSL("myaccount.asp")

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

    but the browser goes to
    https://www.example.com/test/files/myaccount.asp

    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
    Axel

    See my relevant code below:

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

    sUrl=Request.ServerVariables("URL")
    host=Request.ServerVariables("server_name") '
    Request.ServerVariables("HTTP_HOST")

    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.End
    Else
    Response.Redirect sNewURL
    End If
    End Function
     
    Raven, Nov 7, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pooja Renukdas
    Replies:
    3
    Views:
    6,626
    Matt Sollars
    Jul 29, 2003
  2. Ron Howard
    Replies:
    2
    Views:
    529
    Ron Howard
    Aug 11, 2004
  3. Axel
    Replies:
    8
    Views:
    1,108
    Adrienne Boswell
    Apr 27, 2009
  4. jotto
    Replies:
    4
    Views:
    397
    jotto
    Oct 2, 2006
  5. vandenberc

    if Secure statement for https and http

    vandenberc, Mar 27, 2006, in forum: Javascript
    Replies:
    8
    Views:
    111
    Simon
    Mar 29, 2006
Loading...

Share This Page