Forum Moderators: open

Message Too Old, No Replies

retrieve dynamic URLs

         

MaximusB

6:12 pm on Mar 22, 2005 (gmt 0)

10+ Year Member



HI All! I need to know how I can retrieve a full dynamic URL using server variables...
ie. [mypage.asp?cid=4-41&color=blue...]

Maybe I'm a little foggy today, but I just can't seem to get a dynamic url to show.

What I am doing is using MS's little include script to activate SSL for specific pages

<%
If Request.ServerVariables("SERVER_PORT")=80 then
Dim strSecureURL
strSecureURL = "https://"
strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
strSecureURL = strSecureURL & Request.ServerVariables("URL")
Response.Redirect strSecureURL
End If
%>

But I want it to include the querystring variables as well in my dynamic pages.

Thanks for anything you folks can help me with.

mattglet

7:06 pm on Mar 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try:

Request.ServerVariables("QUERY_STRING")

MaximusB

8:07 pm on Mar 22, 2005 (gmt 0)

10+ Year Member



Hmmm when I print the string out it works perfectly, but when I try using the redirect it still won't add the querystring part in. Any ideas?

mattglet

8:08 pm on Mar 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not sure how that's possible... can you post your newest code?

MaximusB

8:59 pm on Mar 22, 2005 (gmt 0)

10+ Year Member



<%
If Request.ServerVariables("SERVER_PORT")=80 then
Dim strSecureURL
strSecureURL = "https://"
strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
strSecureURL = strSecureURL & Request.ServerVariables("URL") & "?"
strSecureURL = strSecureURL & Request.ServerVariables("QUERY_STRING")
Response.Redirect strSecureURL
End If
%>

This is what I have on my site with the redirect. I have also done the same on a test site, but substituted the response.redirect with a response.write. The write gives the exact URL with the querystrings included. When I try to nav to the page with the redirect as an include, it just goes to the base url without including the querystrings

lovethecoast

12:32 am on Mar 23, 2005 (gmt 0)

10+ Year Member



If LCase(Request.ServerVariables("https")) = "off" Then
Response.Redirect "https://" & Request.ServerVariables("server_name") & Request.ServerVariables("url") & "?" & Request.Querystring
End If

MaximusB

12:50 am on Mar 23, 2005 (gmt 0)

10+ Year Member



thnx guys it works now...
i hate to admit what the problem was...
i copied instead of cut the file when I moved it once and I was editing the one that wasn't in the right place.

Stupid stress....

Thanks Guys