103 lines
4.5 KiB
HTML
103 lines
4.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
|
|
<TITLE>CreateObject</TITLE>
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
<!--
|
|
TempString = navigator.appVersion
|
|
if (navigator.appName == "Microsoft Internet Explorer"){
|
|
// Check to see if browser is Microsoft
|
|
if (TempString.indexOf ("4.") >= 0){
|
|
// Check to see if it is IE 4
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else {
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
}
|
|
}
|
|
else if (navigator.appName == "Netscape") {
|
|
// Check to see if browser is Netscape
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
//-->
|
|
</script>
|
|
<SCRIPT LANGUAGE="VBScript">
|
|
<!--
|
|
Sub Window_OnLoad()
|
|
Dim frmContents
|
|
On Error Resume Next
|
|
If Not Parent Is Nothing Then
|
|
Set frmContents = Parent.Contents
|
|
If Not frmContents Is Nothing Then
|
|
frmContents.Window.TOCSynch_Click
|
|
End If
|
|
End If
|
|
End Sub
|
|
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
|
|
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
|
|
<META NAME="MS.LOCALE" CONTENT="EN-US">
|
|
<META NAME="MS-IT-LOC" Content="Internet Information Services">
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
|
|
|
<H4><A NAME="_createobject"></A><SUP></SUP>CreateObject</H4>
|
|
|
|
<P>The <B>CreateObject </B>method creates an instance of a server component. If the component has implemented the <B>OnStartPage</B> and <B>OnEndPage </B>methods, the <B>OnStartPage </B>method is called at this time. For more information about server components, see <A HREF="/iishelp/iis/htm/asp/comp275c.htm">Installable Components for ASP</A>.</P>
|
|
|
|
<H6>Syntax</H6>
|
|
|
|
<P><B>Server.CreateObject(</B> <I>progID</I> <B>)</B></P>
|
|
|
|
<P><B> </B></P>
|
|
|
|
<H6>Parameters</H6>
|
|
|
|
<DL>
|
|
<DT><I>progID</I></DT>
|
|
|
|
<DD>Specifies the type of object to create. The format for <I>progID</I> is [<I>Vendor</I><B>.</B>]<I>Component</I>[<B>.</B><I>Version</I>].</DD>
|
|
</DL>
|
|
|
|
<H6>Remarks</H6>
|
|
|
|
<P>By default, objects created by the <B>Server.CreateObject</B> method have page scope. This means that they are automatically destroyed by the server when it finishes processing the current ASP page.</P>
|
|
|
|
<P>To create an object with 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 store the object in a session or application variable.</P>
|
|
|
|
<P>For example, an object stored in a session variable, as shown in the following script, is destroyed when the <A HREF="/iishelp/iis/htm/asp/vbob12d0.htm"><B>Session</B></A> object is destroyed. That is, when the session times out, or the <A HREF="/iishelp/iis/htm/asp/vbob5tpq.htm"><B>Abandon</B></A> method is called.</P>
|
|
|
|
<PRE><CODE><% Set Session("ad") = Server.CreateObject("MSWC.AdRotator")%>
|
|
</CODE></PRE>
|
|
|
|
<P>You can also destroy the object by setting the variable to <CODE>Nothing</CODE> or setting the variable to a new value, as shown below. The first example releases the object <CODE>ad</CODE>. The second replaces <CODE>ad</CODE> with a string.</P>
|
|
|
|
<PRE><CODE><% Session("ad") = Nothing %>
|
|
<% Session("ad") = "some other value" %>
|
|
</CODE></PRE>
|
|
|
|
<P>You cannot create an object instance with the same name as a built-in object. For example, the following returns an error.</P>
|
|
|
|
<PRE><CODE><% Set Response = Server.CreateObject("Response") %>
|
|
</CODE></PRE>
|
|
|
|
<H6>Example</H6>
|
|
|
|
<PRE><CODE><% Set MyAd = Server.CreateObject("MSWC.AdRotator") %>
|
|
</CODE></PRE>
|
|
|
|
<P>The preceding example creates a server component, <CODE>MyAd</CODE>, as a <B>MSWC.AdRotator</B> component that can be used to automate rotation of advertisements on a Web page. </P>
|
|
|
|
<P>For more information about server components, see the Platform SDK.</P>
|
|
|
|
<H6>Applies To</H6>
|
|
|
|
<P><A HREF="/iishelp/iis/htm/asp/vbob7838.htm"><B>Server</B> Object</A></P>
|
|
<hr class="iis" size="1">
|
|
<p align="center"><em><a href="../../../common/colegal.htm">© 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
|
|
</BODY>
|
|
</HTML>
|