Platform SDK: IIS SDK |
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.
Server.CreateObject( progID)
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 that has session or application scope, you can either use the <OBJECT> tag in the Global.asa file and set the SCOPE attribute to SESSION or APPLICATION, or you can store the object in a session or application variable.
For example, an object stored in a session variable, as shown in the following script, is destroyed when the Session Object object is destroyed. That is, when the session times out, or the Session.Abandon method is called.
<% Set Session("ad") =index.html Server.CreateObject("MSWC.AdRotator")%>
You can also destroy the object by setting the variable to
Nothing
or by setting the variable to a new value, as
shown in the following code. The first example releases the object
ad. The second replaces ad with a string.
<% Session("ad") =index.html 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 =index.html Server.CreateObject("Response") %>
The following example creates a server component, MyAd, as a MSWC.AdRotator component that can be used to automate the rotation of advertisements on a Web page.
<% Set MyAd =index.html Server.CreateObject("MSWC.AdRotator") %>
For more information about server components, see Building COM Components for ASP.
Platforms: Windows 2000 with IIS 5.0 installed,
Windows XP with IIS 5.1 installed,
Windows Server 2003 family with IIS 6.0 installed
What did you think of this topic? |
Order a Platform SDK CD |
file: /Techref/language/asp/OBJ/ref_vbom_seromco.htm, 4KB, , updated: 2003/5/15 14:13, local time: 2024/10/10 21:37,
18.207.255.67:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://piclist.com/techref/language/asp/OBJ/ref_vbom_seromco.htm"> Server.CreateObject</A> |
Did you find what you needed? |
PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to piclist.com! |
.