CreateObject

The CreateObject method creates an instance of a server component. If the component has implemented the OnStartPage and OnEndPage methods, the OnStartPage method is called at this time. ACP's Active Server Pages supports only the page-level events just mentioned. It does not support the ObjectContext object. For more information on creating ASP components, contact DC-3 Dreams.

Syntax

Server.CreateObject( progID )
 

Parameters

progID
Specifies the type of object to create. The format for progID is [Vendor.]Component[.Version].

Remarks

By default, objects created by the Server.CreateObject method have page scope. This means that they are automatically destroyed by the server when it finishes processing the current ASP page.

To create an object with session or application scope, you can store the object in a session or application variable. Note: The standard ACP <OBJECT> tag is not supported by ACP.

For example, an object stored in a session variable, as shown in the following script, is destroyed when the Session object is destroyed. That is, when the session times out, or the Abandon method is called.

<% Set Session("ad") = Server.CreateObject("PinPoint.Plate")%>
 

You can also destroy the object by setting the variable to Nothing or setting the variable to a new value, as shown below. The first example releases the object ad. The second replaces ad with a string.

<% Session("ad") = Nothing %>
<% Session("ad") = "some other value" %>
 

You cannot create an object instance with the same name as a built-in object. For example, the following returns an error.

<% Set Response = Server.CreateObject("Response") %> 
 

Example

<% Set Plate = Server.CreateObject("PinPoint.Plate") %> 
 

The preceding example creates a server component, Plate, as a PinPoint.Plate component that can be used to perform astrometric operations on images and display results on a web page.

Applies To

Server Object