使用变量的经典ASP重定向URL

时间:2012-10-15 02:25:29

标签: url asp-classic response.redirect

我有一个变量标签<%test_variable%>这是来自结果集。

我想使用此<%= test_variable%>重定向到一个链接,比如说

http://www.helloworld.someurl.com/testUrl?somevariable=<%=test_variable%>&test=ok

如何在&lt; %%&gt;中执行此操作标签?例如,

<%=test_variable%> 

<%
' I want to redirect the url with the above tag, something like:

Response.Redirect(" http://www.helloworld.someurl.com/testUrl?somevariable=<%=test_variable%>&test=ok")
%>

但我认为我们不能拥有“嵌套标签”,对吗?

我对ASP很新。

3 个答案:

答案 0 :(得分:3)

<%= %><% Response.Write(" ... "); %>的缩写:

http://www.helloworld.someurl.com/testUrl?somevariable=<%=test_variable%>&test=ok

澄清后:

<%
    Response.Redirect("http://www.helloworld.someurl.com/testUrl?somevariable="
                     + test_variable
                     + "&test=ok");
%>

答案 1 :(得分:1)

您的代码应为

Response.Redirect("http://www.helloworld.someurl.com/testUrl?somevariable=" & test_variable & "&test=ok")

答案 2 :(得分:1)

感谢大家的建议......

我决定改用它:

<script type="text/javascript">
   window.location =  "http://www.helloworld.someurl.com/testUrl?somevariable="+<%=test_variable%>+"&test=ok"
</script>
相关问题