Switching Between HTTP and HTTPS

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Switching Between HTTP and HTTPS

    Hi
    I wish to have a web site that has most of the pages as normal HTTP pages
    but has some areas that use HTTPS. I want to have it that if a user selects
    a link to a HTTPS page that they go there an there Session Information is
    kept. I also wish to have the pages switch automatically to HTTPS if a
    visitor types the URL without the HTTPS. So my questions are:
    1) How to redirect to a Secure Page without losing Session Info?
    2) How to test if page is accessed by HTTPS, and if not switch to HTTPS
    quickly?

    I think something like this code is what I want but how do I do it.

    <%
    if not "HTTPS" then
    response.redirect([url]https://mysite.com/securepage.asp[/url])
    end if
    %>

    Thanks for the help.
    Kenneth Keeley


    Kenneth Keeley Guest

  2. Similar Questions and Discussions

    1. http to https
      Is there a coldfusion function that determines the gives me the protocol of the address bar(http, https) .I tried GetHttpRequestData, but I do not...
    2. Switching between http and https popping up a login box
      Hi, I am response.redirecting from an http to a https site, as follows: ...
    3. PHP won't parse under https, but will with http
      I'm not sure if this is the right forum for this question, but I'm hoping someone can help nonetheless. :) I installed an SSL Cert. on a site the...
    4. HTTPS to HTTP
      When I am using server-side button to switch from https to http by using response.redirect "http://a.apsx" in response to the client event, I am...
    5. Switching to and from http and https
      hello all. currently, this is how a line of my form is setup (names have been changed to protect the innocent ;) <form...
  3. #2

    Default Re: Switching Between HTTP and HTTPS


    "Kenneth Keeley" <kenkeeley@hotmail.com> wrote in message
    news:e9bEtKgkDHA.2500@TK2MSFTNGP10.phx.gbl...
    > So my questions are:
    > 1) How to redirect to a Secure Page without losing Session Info?
    This is not possible. Sessions cannot be maintained across different
    protocols. You'll have to store the info server-side in a database, for
    example.
    > 2) How to test if page is accessed by HTTPS, and if not switch to
    HTTPS
    > quickly?
    Here's an example:
    [url]http://www.aspfaq.com/2321[/url]

    You'd probably also want to grab the querystring, should it exist. Maybe do
    it like this instead (illustrative example):

    <%
    Dim sRedirect, sDomain, sPath, sQString
    If UCase(Request.ServerVariables("HTTPS") = "OFF" Then
    sDomain = Request.ServerVariables("SERVER_NAME")
    sPath = Request.ServerVariables("SCRIPT_NAME")
    sQString = Request.Querystring
    sRedirect = "https://" & sDomain & sPath
    If Len(sQString) > 0 Then sRedirect = sRedirect & "?" & sQString
    Response.Redirect sRedirect
    End If
    %>


    Ray at home


    Ray at Guest

  4. #3

    Default Switching between http and https

    I have two forms,1 is http and another is https. Https is a pop up form and
    http is its opener.
    Now, I want to pass back some data from Https side to its opener page but it
    prompts message" permission denied."
    Is it possible that i can refresh or pass back some data to the http page
    from the Https side?


    here's the code
    RegisterStartupScript("save", "<script>try{window.opener.creditCard('" &
    MemberPaymentID & "')}catch(e){var
    frm=window.opener.frmMain;frm.MemberPaymentID.valu e='" & MemberPaymentID &
    "';frm.Process.value='Save';frm.submit();} window.close();</script>")

    CS Guest

  5. #4

    Default Re: Switching between http and https

    I don't think it'll work using javascript - under the security model (IIRC),
    an SSL site and it's non-SSL counterpart are effectively two different
    domains.

    http and https are cordoned off for a reason, though - have you fully
    considered the implications of bouncing data in and out of the secure area?
    isn't it better to keep it all cordoned off?


    --
    Jason Brown
    Microsoft GTSC, IIS

    This posting is provided "AS IS" with no warranties, and confers no rights.

    "CS" <CS@discussions.microsoft.com> wrote in message
    news:4C28F77D-95CB-483A-96D3-746F4CCDE306@microsoft.com...
    >I have two forms,1 is http and another is https. Https is a pop up form and
    > http is its opener.
    > Now, I want to pass back some data from Https side to its opener page but
    > it
    > prompts message" permission denied."
    > Is it possible that i can refresh or pass back some data to the http page
    > from the Https side?
    >
    >
    > here's the code
    > RegisterStartupScript("save", "<script>try{window.opener.creditCard('"
    > &
    > MemberPaymentID & "')}catch(e){var
    > frm=window.opener.frmMain;frm.MemberPaymentID.valu e='" & MemberPaymentID &
    > "';frm.Process.value='Save';frm.submit();} window.close();</script>")
    >

    Jason Brown [MSFT] Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139