This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for

Collection objects are data structures that are similar to arrays and that store strings, numbers, objects, and other values. The collections that Windows Mobile supports provide a convenient way to read query string, form, and cookie data that are sent from the client browser and to create cookies on responses. Windows Mobile implements the Response.Form, Response.QueryString, Request.Cookies, and Response.Cookiesmethods as collections.

Windows Mobile ASP uses the same syntax that is used with IIS-based ASP for most of the collection objects.

Request.ServerVariablesis implemented as a method, not as a collection, on Windows Mobile ASP; attempts to treat it as a collection object fail. For example, the following line is not valid on Windows Mobile ASP.

Copy Code
<% Request.ServerVariables("URL").Count %>

IIS allows the Responseobject to be accessed as a collection object. The Responseobject searches for the value that is specified in the QueryString, Form, Cookies, ClientCertificate, and ServerVariablesmethods and returns the value if it finds a match in this case. Windows Mobile has no support for this functionality. For example, the following action is valid on IIS, but not on Windows Mobile.

Copy Code
<% Request("URL") %> 

None of the collection objects supports iteration. For example, the following VBScript operation returns an error message that states that the method is not implemented on Windows Mobile ASP.

Copy Code
for each Item in Request.Cookies
Response.Write Item

Cookies cannot be subindexed on Windows Mobile. Only one value may be set per named cookie. For example, calling the following example fails on Windows Mobile.

Copy Code
<% Response.Cookies("Index")("Sub-index") = "Value" %>

Similarly, the Request.Cookiesmethod does not parse out indexed arrays.

Only the following use of cookies is valid on Windows Mobile.

Copy Code
<% Response.Cookies("Index") = "Value %>

The Response.Cookiesmethod supports the Path, Domain, and Expiresattributes, which can be set individually for each cookie value. The Secureattribute is not supported in Windows Mobile ASP.

On IIS, it is possible to assign attributes to a response cookie before setting the value of the cookie or without setting the value at all. For instance, the following sequence is valid.

Copy Code
Response.Cookies("Index").Path = "/"
Response.Cookies("Index") = "Value"  ` set the Path attribute
before the cookie value

Windows Mobile requires that the value of the cookie be set before setting any of its attributes. Attempting to run the previous code on Windows Mobile ASP would return the error "The collection object specified is read-only."

See Also