Request.Querystring(variablevalue) possible?

asp-classic, request.querystring

Solution

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.

Problem

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".

Original source