如何在ASP中使用查询字符串服务器变量编写Response.redirect

如何在ASP中使用查询字符串服务器变量编写Response.redirect,redirect,asp-classic,server-variables,Redirect,Asp Classic,Server Variables,我正在尝试将用户重定向到我的移动页面,相当于桌面页面。现在我只能把它们放到主页上 If b.test(u) or v.test(Left(u,4)) then response.redirect("/mobile.asp") End If 我想用其他正确的变量重定向到移动页面。因此,重定向响应应该是从“/home.asp?m=here”页面转到“/mobile.asp?m=here”,从“/home.asp?m=here”页面转到“/mobile.asp?m=here”等等 我可以使用获取变量

我正在尝试将用户重定向到我的移动页面,相当于桌面页面。现在我只能把它们放到主页上

If b.test(u) or v.test(Left(u,4)) then response.redirect("/mobile.asp") End If
我想用其他正确的变量重定向到移动页面。因此,重定向响应应该是从
“/home.asp?m=here”
页面转到
“/mobile.asp?m=here”
,从
“/home.asp?m=here”
页面转到
“/mobile.asp?m=here”
等等

我可以使用
获取变量,但是当我尝试连接重定向时,我的语法必须关闭

If b.test(u) or v.test(Left(u,4)) then response.redirect("/mobile.asp?&Response.Write(Request.ServerVariables("QUERY_STRING"))&""") End If

没什么帮助。谢谢。

你不需要
回复。在那里写
。类似这样的东西(虽然没有测试过)


response.redirect(“/mobile.asp?”&Request.ServerVariables(“QUERY_STRING”))

为了将动态内容放入字符串中,必须首先确定它,然后使用
&
连接其他字符串/变量。因此,您希望您的代码如下所示:

If b.test(u) or v.test(Left(u,4)) then response.redirect("/mobile.asp?" & Response.Write(Request.ServerVariables("QUERY_STRING"))) End If

此外,您应该检查任何查询字符串,以了解是否需要放置

很高兴我能帮上忙,如果可以的话,别忘了在回答的问题上做标记:)