Request.Querystring(variablevalue)可能吗?(Request.Querystring(variablevalue) possible?)

编程入门 行业动态 更新时间:2024-10-28 19:26:44
Request.Querystring(variablevalue)可能吗?(Request.Querystring(variablevalue) possible?)

我正在创建一个使用request.querystring在页面之间传输变量的应用程序。 但是,目前我根据数组动态地在URL中设置变量名称,并且我想使用(基本上)相同的数组在另一个页面上检索这些值。 所以我提出了我认为简单的解决方案:

For Each x In AnswerIDs response.write(x) ctest = Request.Querystring(x) response.write(ctest) Next

但是这似乎不起作用,因为看起来你不能使用带变量的Request.Querystring()作为它的参数。 有谁知道我怎么能这样做?

这是查询字符串:

QuizMark.asp?11 = 1&12 = 1

在这种情况下,AnswerIDs由“11”和“12”组成,所以在我的循环中我希望它写“1”和“1”。

I'm creating an application which uses request.querystring to transfer variables between pages. However at the moment I am setting variable names in the URL dynamically in accordance with an array and I want to retrieve these values on another page using (essentially) the same array. So I came up with what I thought would be the simple solution:

For Each x In AnswerIDs response.write(x) ctest = Request.Querystring(x) response.write(ctest) Next

However this doesn't seem to work as it looks like you can't use Request.Querystring() with a variable as it's parameter. Has anyone got any idea how I could do this?

This is the query string:

QuizMark.asp?11=1&12=1

In this case AnswerIDs consists of "11" & "12" so in my loop I want it to write "1" & "1".

最满意答案

您可以像这样遍历查询字符串:

For Each Item in Request.QueryString Response.Write Item & ": " & Request.QueryString(Item) & "<br/>" Next

Item包含querystring参数的名称,使用Request.Querystring(Item)检索参数的值。

You can loop through the querystring like this:

For Each Item in Request.QueryString Response.Write Item & ": " & Request.QueryString(Item) & "<br/>" Next

Item contains the name of the querystring parameter, with Request.Querystring(Item) you retrieve the value of the parameter.

更多推荐

本文发布于:2023-04-29 23:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336677.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Request   Querystring   variablevalue

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!