Name

StaticObjects — Application.StaticObjects( Key)

Synopsis

The StaticObjects collection contains all of the objects added to the application through the use of the <OBJECT> tag. You can use the Item property (discussed later) of the StaticObjects collection to retrieve properties of a specific object in the collection. You also can use the Item property of the StaticObjects collection to access a specific method of a given object in the collection.

You can add objects to this collection only through the use of the <OBJECT> tag in the GLOBAL.ASA file, as in the following example:

<OBJECT RUNAT=Server SCOPE=Application ID=AppInfo2 
        PROGID="MSWC.MyInfo">
</OBJECT>

You cannot add objects to this collection anywhere else in your ASP application.

The StaticObjects collection, like other ASP collections, has the following properties:

Item

Returns a reference to a specific element in the collection. To specify an item, you can use an index number or a key.

Key

Returns the name of a specific element in the collection; the name is assigned by the ID attribute of the <OBJECT> tag. For example, you could receive the name of the first element in the collection like this:

objElement = Application.StaticObjects.Key(1)

Use the value of the Key property to retrieve the value of an element by name. For example, suppose the first object in the StaticObjects collection is named MyAdRotator. You could then use the following line of code to set (or retrieve) the value of the Border property of that object: ...

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.