ALP CreateObject method
Creates an instance of a registered, non-registered ActiveX component or a composite object.

Syntax:

Server.CreateObject( progID_or_ClassID )

Parameters:

progID_or_ClassID - The name (ProgID) or the ClassID of the object to create. For example newObjecte.utilctls.SFMain. Usually the syntax of the progID will follow the syntax [Vendor].Component.[version] but it is only a string associated with the Class ID of the component's class and some vendors prefer more descriptive names like us.

See the remarks section for more details.

See the ALP Run-time library for the list of the components always supplied with ALP. These objects can be always created because they are part of the ALP product. If you want to port ASP page(s) that use these components to an IIS machine you will need to install on the IIS machine the newObjects ActiveX Pack1 family.

Scope of the objects created using the CreateObject method is the page/request. If you want to preserve the object for usage in other pages save it into the Session or Application.

Examples:

JScript:

<% var objMyObject = Server.CreateObject("newObjecte.utilctls.SFMain"); %>

VBScript:

<% Set objMyObject = Server.CreateObject("newObjecte.utilctls.SFMain") %>

Of course in the raw scripts <% %> will not be present.

Remarks

In ALP the Server.CreateObject has extended functionality. By default it supports both ProgID and ClassID. For example you can create the SFMain object by using its ProgID

Set sf = Server.CreateObject("newObjecte.utilctls.SFMain")

or by using its ClassID:

Set sf = Server.CreateObject("{F86AC6C2-5578-4AE8-808A-DC5DAA78082A}")

Furthermore, if you define some COM aliases in the ALP Application settings for the ASP pages, you can use these aliases instead of the object's ProgID.

More extensions are available if the Extended CreateObject option is checked in the ALP Application settings. If that option is set the Server.CreateObject will also accept physical path to a composite object definition file and even physical path to DLL with padded ClassID of a class implemented in it. When the Extended CreateObject is set ALP uses internally the CreateObject implemented by the Pack1Creator object. See its documentation for all the possible extended creation techniques.

ALP supports ASP objects (in ALP we call them ALP objects). These are COM objects especially designed to integrate tightly with the ASP module. These objects are advised by the ASP module with direct pointers to the ASP objects (Request, Response, Server and so on). This way such objects can query the request, generate output and otherwise directly access the ASP object model without help from the ASP code. This is especially useful when you want to move part of the functionality of the application to COM component(s) and minimize the code needed when using them. See the ALP/ASP Objects for more information.

One good example for the usefulness of an ALP/ASP object is a browser information object (there is such a sample shipping with ALP). You expect from such an object to devise some useful information about the user's machine and browser from the user agent information. If such an object is designed as ALP/ASP Object you will need only to create it. When created it will retrieve the information it needs on its own and will be ready to give you the results. It it is not designed this way you will need to feed it with some information from the ASP page - for example you would need to set a property with the user agent string first. This way the object saves you the effort and gathers the needed information directly from the ASP module.

Applies to: Server object

newObjects Copyright 2001-2006 newObjects [ ]