Comments/Troubleshooting
In the previous discussion of ASP and
the GET
and POST
methods, we
saw that information from a GET
is retrieved by
using the QueryString collection and that information from a
POST
is retrieved by using the Form collection.
This is true, but there is a simpler way: you do not have to specify
a collection. For example, the code:
strName = Request("name")
returns the value of the "name" key regardless of the collection in which it's located, because IIS searches all collections. When you specify a value in this manner, ASP looks through each Request object collection in the following order:
QueryString
Form
Cookies
ClientCertificate
ServerVariables
The variable you are initializing will receive the value in the first instance of the name/value pair whose name matches the string requested. For this reason, it is important to realize that if you have the same name/value pair in two or more collections, you will receive the first one found according to the preceding sequence, unless you specify a particular collection.
As with the other collections in the ASP object model, all the
collections discussed in this chapter for the Request object support
the Item and Key properties, the Count method, and the
For..Each
construct.
Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.