Reputation: 831
I'm trying to redirect users to my mobile page equivalent of a desktop page. Right now I can only get them to the home page.
If b.test(u) or v.test(Left(u,4)) then response.redirect("/mobile.asp") End If
I'd like to redirect to the mobile page with the additional correct variables. So the redirect response should be to "/mobile.asp?m=here"
from the "/home.asp?m=here"
page and "/mobile.asp?m=there"
from the "/home.asp?m=there"
etc.
I can get the variables with <% Response.Write(Request.ServerVariables("QUERY_STRING")) %>
but my syntax must be off when I try to concat the redirect
If b.test(u) or v.test(Left(u,4)) then response.redirect("/mobile.asp?&Response.Write(Request.ServerVariables("QUERY_STRING"))&""") End If
Little help. Thanks.
Upvotes: 1
Views: 942
Reputation: 357
In order to put something dynamic into your string it has to be determinated first, then use a &
to concatenate other strings / variables. So you want your code to look like this:
If b.test(u) or v.test(Left(u,4)) then response.redirect("/mobile.asp?" & Response.Write(Request.ServerVariables("QUERY_STRING"))) End If
also, you should check for any query strings to know weather to put the ?
or not.
Upvotes: 0
Reputation: 629
You don't need the response.write
in there. Something like this (not tested it though)
response.redirect("/mobile.asp?" & Request.ServerVariables("QUERY_STRING"))
Upvotes: 3