www.webdeveloper.com
Results 1 to 8 of 8

Thread: how to prevent ssl??

  1. #1
    Join Date
    Oct 2005
    Posts
    25

    how to prevent ssl??

    Is there any way I can redirect certain pages from https to http without hard coding all my links? I think a lot of people are going to the checkout page on our shopping cart (which is https), then clicking on another link and getting stuck in https the rest of the time their browsing. If you go to https://www.google.com it automatically redirects you to a non ssl page. Anyone know how to do this? Site is on classic asp if it matters.

    Thanks
    -Andrew

  2. #2
    Join Date
    Mar 2006
    Posts
    591
    You can check if your user is on https or not with

    Code:
    Request.ServerVariables("HTTPS")
    It will return on or off.


    If it is and it shouldn't be, just redirect your user to the http.
    The redirect will only been done once, because your user will be on http for then on.

  3. #3
    Join Date
    Oct 2005
    Posts
    25
    Quote Originally Posted by Terrorke
    You can check if your user is on https or not with

    Code:
    Request.ServerVariables("HTTPS")
    It will return on or off.


    If it is and it shouldn't be, just redirect your user to the http.
    The redirect will only been done once, because your user will be on http for then on.
    Ah...so

    Code:
    pUrl=Request.ServerVariables("url")
    if Request.ServerVariables("HTTPS")="on" and pUrl<>"/sslpage.asp" then
    response.redirect("http://www.mysite.com"&pUrl)
    end if
    seems to do the trick

    Thanks!
    -Andrew

  4. #4
    Join Date
    Oct 2005
    Posts
    25
    I almost forgot querystrings

    Code:
    pUrl=request.servervariables("url")
    pStrings=request.ServerVariables("QUERY_STRING")
    if Request.ServerVariables("HTTPS")="on" and pUrl<>"/sslpage.asp" then
    response.redirect "http://www.mysite.com"&pUrl&"?"&pStrings
    end if

  5. #5
    Join Date
    May 2006
    Location
    Sydney, Australia
    Posts
    125
    Does this work in reverse as well, eg they got to a site that should be SSL and forgot the "s"???

    Im very interesting in it.
    </VANNY>

  6. #6
    Join Date
    Mar 2006
    Posts
    591
    Yep you can also do it in the reverse way.

    mojo3120,

    Make sure you have all the querystring variables.
    you can also use request.servervariables("QUERY_STRING") to get the complete string following the question mark (?)

    This way you are sure you have all the variables.

  7. #7
    Join Date
    Dec 2003
    Location
    England, UK
    Posts
    432
    to do it the other way around when the "ssl required" box is checked in IIS you need to write a custom error page and set it up for your website/virtual directory.

  8. #8
    Join Date
    May 2006
    Location
    Sydney, Australia
    Posts
    125
    Thanks, I might have to have a play with this.

    Could solve a lot of my problems when people miss advertise a URL
    </VANNY>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles