Using ASP to capture a query string and redirect to SSL

Discussion in 'ASP General' started by Nuevo, Jul 20, 2006.

  1. Nuevo

    Nuevo Guest

    Nuevo, Jul 20, 2006
    #1
    1. Advertising

  2. Nuevo

    Mike Brind Guest

    Nuevo wrote:
    > I am looking for some method to capture, into a variable, the entire URL of
    > an http request and redirect to SSL. For example, if a user opens a browser
    > and typed in
    >
    > http://myserver.com/application/some.asp?form=y&format=mgs&customerid=893bdgt0248991
    >
    > I want to be able to redirect to an SSL connection
    >
    > httpS://myserver.com/application/some.asp?form=y&format=mgs&customerid=893bdgt0248991
    >
    > Your help is appreciated.


    <%
    url = "https://myserver.com/application/some.asp?"
    qrystr = ""
    For Each x In Request.QueryString
    qrystr = qrystr & "&" & x & "=" & Request.QueryString(x)
    Next

    strRedirect = url & right(qrystr,len(qrystr)-1)

    Response.Redirect strRedirect
    %>

    --
    Mike Brind
     
    Mike Brind, Jul 20, 2006
    #2
    1. Advertising

  3. "Nuevo" <> wrote in message
    news:...
    >I am looking for some method to capture, into a variable, the entire URL of
    >an http request and redirect to SSL. For example, if a user opens a browser
    >and typed in
    >
    > http://myserver.com/application/some.asp?form=y&format=mgs&customerid=893bdgt0248991
    >
    > I want to be able to redirect to an SSL connection
    >
    > httpS://myserver.com/application/some.asp?form=y&format=mgs&customerid=893bdgt0248991
    >
    > Your help is appreciated.


    This expression should get everything but the protocol from the original
    URL, including the server's host name, file name and any directory info that
    may have been included:

    Url = Request.ServerVariables("SERVER_NAME") & _
    Request.ServerVariables("URL") & "?" & _
    Request.ServerVariables("QUERY_STRING")

    Response.Redirect "https://" & Url


    -Mark
     
    Mark J. McGinty, Jul 21, 2006
    #3
    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. Sean Wolfe
    Replies:
    1
    Views:
    2,313
    Joerg Jooss
    Apr 28, 2005
  2. Max
    Replies:
    7
    Views:
    9,182
  3. IBCK
    Replies:
    1
    Views:
    775
  4. Sal
    Replies:
    1
    Views:
    990
  5. nick
    Replies:
    1
    Views:
    511
    David Mark
    Feb 13, 2011
Loading...

Share This Page