Microsoft Windows CE 3.0  

Collection Objects

Important:
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.

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

Windows CE ASP uses the same syntax that is used on IIS for most of the collection objects.

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

<% 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 CE has no support for this functionality. For example, the following action is valid on IIS, but not on Windows CE:

<% Request("URL") %>

None of the collection objects supports iteration. For example, the VBScript operation

<% for each Item in Request.Cookies
Response.Write Item Next %>

returns an error message that states that the method is not implemented on Windows CE ASP.

Cookies cannot be subindexed on Windows CE. Only one value may be set per named cookie. For example, calling

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

fails on Windows CE. Similarly, the Request.Cookiesmethod does not parse out indexed arrays.

Only the following use of cookies is valid on Windows CE:

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

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:

<% Response.Cookies("Index").Path = "/"
Response.Cookies("Index") = "Value" ` set the Path attribute before
the cookie value %>

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



 Last updated on Friday, April 02, 2004

© 2004 Microsoft Corporation. All rights reserved.