Easy Tutorial
❮ Prop Sessionid Met End ❯

ASP CreateObject Method



The CreateObject method creates an instance of an object.

Note: Objects created with this method have page scope. This means that once the current ASP page processing is complete, the server will automatically destroy these objects. To create objects with session or application scope, you can use the <object> tag in the Global.asa file and set the SCOPE attribute for session or application, or store the object in a session or application variable.

Syntax

Parameter Description
progID Required. The type of object to create.

Example 1

This example creates an instance of the server component MSWC.AdRotator:

Example 2

When the session ends, the object stored in the session variable is destroyed. However, you can also destroy the object by setting the variable to Nothing or a new value:

Example 3

You cannot create an instance of an object with the same name as a built-in object. For example, the following script will return an error:


❮ Prop Sessionid Met End ❯