Whats the best way to get out of https and back to http

Posted on 2006-04-22
Last Modified: 2010-04-09
Many of my links on my pages are "../products.asp" etc... i..e they dont all have

so now some of my pages are https for example like my checkout pages.. but suppose if a user clicked on a link from within a https page like a  help link...   now the help link need not be secure right??  so in this case it should go back to http://.....  instead of https://

becuase my help page link is simply "help.asp" and not the full path it prepends the link with the current server protocol.

so whats the best way that many websites use to get out of https and back to http.?

i know that i can have a script that detects the protocol and can redirect right but is this the best way?  if it is, can someone tell me that script?
Question by:Ricky11
    LVL 8

    Accepted Solution

    Suppose your ASP always run under HTTP, not HTTPS.

    You note that HTTPS use port 443 while HTTP use port 80.

    So you may try putting this before the ASP actually begins:

    If Request.ServerVariables("SERVER_PORT") <> 80 Then
      Response.Redirect ""  & Request.ServerVariables("URL")
    End If

    Hope this helps.

    Author Comment

    Yeah okay.. but the problem is the page will be in https... becuase the user would have clicked on a link from within a secure page, and that link will take on the https protocol.. so it would also be in port 443.

    as i mentioned my links do not have the full url they are like "products.asp" or "help.asp" etc..

    so when i do specify then if the user decides to click on products.asp from within the secure page.. https will be attatched to the link as  ...

    so how do i change that so only certian pages are https... without going in and changing all my pages to the full url..


    Author Comment

    so when i do specify https...

    should be as abvoe...

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now