

ASP ADVANCED
Most application variables
are actually stored in the Contents collection of the Application object.
Whenever you create a new application variable, a new item is added
to this collection. For
example, the following two statements are equivalent:
<%
Application("FavoriteColor")="Blue" %>
<% Application.Contents("FavoriteColor")="Blue"
%>
Because application
variables are stored in a collection, you can manipulate them by using all
the collection methods previously discussed.
You can retrieve a count of the number of application variables by
using the count method. You
can display all the items contained in the contents collection by using
either a FOR ...EACH loop or a FOR ...NEXT loop.
Here's an example using a FOR ...EACH loop:
<%
FOR EACH thing IN Application.contents
Response.Write("<BR>"&thing&"="&Application.Contents(thing))
NEXT
%>
This script displays all
the application variables by looping through the Application.Contents
collection.
|