Using ASP to capture a query string and redirect to SSL

M

Mike Brind

Nuevo said:
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
%>
 
M

Mark J. McGinty

Nuevo said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top