In vbScript, the code:
For Each Key In Request.QueryString
will treat Request.QueryString like a collection and you can iterate through it. But the code:
mysite.com?<%=Request.QueryString%>
(ignoring sanitizing for now) treats Request.QueryString like a string with ampersands and equal signs.
My question: is it possible to create an object that behaves just like this, or is this unique to Request?
Thank you. I'm trying to write a wrapper object to sanitize the two Request collections (QueryString and Form) and it would be easier if I could include this feature.
(It was suggested that a prior question about building dictionaries may have related to my issue. It does not. That article talks about how to build a dictionary, but nowhere does it address my question, which is: given a dictionary created inside an object, how can you get a reference to the dictionary (NOT a particular element) to produce a string (like Request.Form, which will produce something like "var1=valone&var2=valtwo" if you use Response.Write(Request.Form) but will produce "valtwo" if you use Response.Write(Request.Form("var2")). And I don't mean is there some way to manipulate vbScript to extract such a string. I mean literally, if you reference the dictionary (without parentheses) how can you make that produce a string the way Request.Form (or Request.QueryString) does? There is nothing about this in that post. (At the risk of sending somebody else off on another unhelpful (no offense meant) tangent, let me repeat -- I'm trying to wrap Request in an object (to permit sanitizing) and it would be nice if I could make the wrapper object behave like Request itself in this particular aspect. I don't think it is possible, but first you need to understand what I'm asking for.))