The ASP Server CreateObject Method is used to create an instance of a server object. The object created by this method has page scope. These objects are destroyed when the server finished the Current ASP page. We generally use the <object>tag in Global.asa file to create an object in the Session or Application.
Syntax:
Server.CreateObject(progID)
Parameter Values: It Contains the value i.e progID which represents the type of object to create. The format for progID is Component. It is a required parameter.
Example-1: Below code, used to create an Object.
ASP
<%
Set adrot=Server.CreateObject( "MSWC.AdRotator" )
%>
|
Example-2: Below code illustrates that we cannot create an object with the same name as the in-built Object.
ASP
<%
Set Application=Server.CreateObject( "Application" )
%>
|