Exforsys
+ Reply to Thread
Results 1 to 3 of 3

How to convert http to https.

This is a discussion on How to convert http to https. within the ASP forums, part of the Programming Talk category; Hi .. I m new in ASP... I have assigned a project in my university to develop any web page ...

  1. #1
    saquib1982 is offline Saqi Array
    Join Date
    May 2007
    Location
    Pakistan, Karachi
    Answers
    3

    How to convert http to https.

    Hi ..

    I m new in ASP... I have assigned a project in my university to develop any web page which code is secure... so i need to convert http to https... If any one have some idea about this then plz plz help me.. Its urgent.....

    Regards,
    Saqi


  2. #2
    JenniP is offline Junior Member Array
    Join Date
    Sep 2007
    Answers
    4
    If you want to check if the page you are on is secure you can use

    Request.ServerVariables("HTTPS") this will return "off" if its an HTTP page and "on" if its an https page.

    So if your pointing at an HTTP page you then need to use a redirect to point to the HTTPS version of the page.

    Because you are changing protocol you have to use a response.redirect rather than a server.transfer. This will also allow the web browser to check the SSL certificate.

    So some code that will do this is below

    if Request.ServerVariables("HTTPS") = "off" then
    srvname = Request.ServerVariables("SERVER_NAME")
    scrname = Request.ServerVariables("SCRIPT_NAME")
    response.redirect("https://" & srvname & scrname)
    end if

    This will have a downside of losing any HTTP get/post data but will jump you to a secure session.

    Jen


  3. #3
    solar is offline Junior Member Array
    Join Date
    Sep 2007
    Answers
    1
    Hi Jen

    Great, thats a big help I was looking for for exactly this and Google bought me to you. I'm not worried about my get data, perfect solution - thanks


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...