我正在创建一个使用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) NextHowever 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/>" NextItem包含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/>" NextItem contains the name of the querystring parameter, with Request.Querystring(Item) you retrieve the value of the parameter.
更多推荐
发布评论