Request object

The client request.
ContentsASP
Request.BinaryRead methodReturns the requested number of binary bytes from those sent by the client.1
Request.ClientCertificates collectionProperties of the client certificate, when one is sent by the browser.1
Request.Cookies collectionPotentially two-dimensional read-only collection of persistant client values.1
Request.Form collectionData passed to the server via a POST form.1
Request.QueryString collectionData passed to the server as a part of the URL, as with a GET form.1
Request.ServerVariables collectionA collection of standard CGI values.1
Request.TotalBytes propertyThe size of the client request, used with BinaryRead.1

Details

The Request object does not have a traditional default member. Instead, when accessing the object as a collection, it returns the first match found after searching its five member collections for the key, in this order:

  1. Request.QueryString collection

  2. Request.Form collection

  3. Request.Cookies collection

  4. Request.ClientCertificates collection

  5. Request.ServerVariables collection

Each of these collections contains a collection of IStringList collection items.

Tip

Using the Request collection allows a more concise and flexible access method for form variables; by using Request("id") rather than Request.Form("id"), you can pass the id variable via a POST form, or a simple link (from a search results page, for example) interchageably.

Warning

It is best to avoid using the Request collection to access the Request.ServerVariables collection for two reasons: first, it is the last collection searched, which means the search will take longer; and second, an item from another collection with the same name will supercede the value, allowing exploits and causing bugs. In the following example, a malicious user could easily pass a query string of ?LOGON_USER=Administrator.

Example 1.7.1. The Wrong Way To Check For Authentication

If Request("LOGON_USER") = "" Then ' WRONG! Any Request collection could provide this value!
  Response.Status= "401 Unauthorized"
  Response.End
End If

Example 1.7.1. Collecting Multiple Values From a Field

For i= 1 To Request("field").Count ' IStringList collections begin at 1
  ' use value
Next