2025-04-27 07:49:33 -04:00

120 lines
4.3 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>&lt;OBJECT&gt; Declarations</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">
<H2><A NAME="__object_declarations"></A><SUP></SUP>&lt;OBJECT&gt; Declarations</H2>
<P>You can create objects with session or application scope in the Global.asa file by using the extended &lt;OBJECT&gt; tag. This tag is self-contained and is outside of any &lt;SCRIPT&gt; tags. </P>
<P>The objects declared in the Global.asa file are not created until the server processes a script that calls that object. This saves resources by creating only the objects that are needed.</P>
<H6>Syntax</H6>
<P><B>&lt;OBJECT RUNAT=Server SCOPE=</B><I>Scope</I> <B>ID=</B><I>Identifier</I> {<B>PROGID="</B><I>progID</I><B>"</B>|<B>CLASSID="</B><I>ClassID</I><B>"</B>}<B>&gt;</B><BR>
. . .</P>
<P>&nbsp;</P>
<P><B>&lt;/OBJECT&gt;</B></P>
<P><B>&nbsp;</B></P>
<H6>Parameters</H6>
<DL>
<DT><I>Scope</I></DT>
<DD>Specifies the scope of the object. In the Global.asa file, <I>Scope </I>will be set to either Session or Application. <BR>
</DD>
<DT><I>Identifier</I></DT>
<DD>Specifies a name for the object instance.<BR>
</DD>
<DT><I>ProgID</I></DT>
<DD>An identifier associated with a class identifier. Either <I>ProgID </I>or <I>ClassID </I>must be specified in the &lt;OBJECT&gt; tag. The format for <I>ProgID </I>is [Vendor<B>.</B>]Component[<B>.</B>Version].<BR>
</DD>
<DT><I>ClassID</I></DT>
<DD>Specifies a unique identifier for an COM class object. Either <I>ProgID </I>or <I>ClassID </I>must be specified in the &lt;OBJECT&gt; tag.</DD>
</DL>
<H6>Examples</H6>
<P>The first of the following examples creates an object of session scope named <CODE>MyConnection</CODE> by using the <I>ProgID </I>parameter. The second example uses the <I>ClassID </I>parameter.</P>
<PRE><CODE>&lt;OBJECT RUNAT=Server SCOPE=Session ID=MyConnection
PROGID="ADODB.Connection"&gt;
REM Object Script
&lt;/OBJECT&gt;
&lt;OBJECT RUNAT=Server SCOPE=Session ID=MyConnection
CLASSID="Clsid:8AD3067A-B3FC-11CF-A560-00A0C9081C21"&gt;
REM Object Script
&lt;/OBJECT&gt;
</CODE></PRE>
<H6>Remarks</H6>
<P>The objects declared in the Global.asa file can be used by any script in the application. For example, if you declared the following object.</P>
<PRE><CODE>---GLOBAL.ASA---
&lt;OBJECT RUNAT=Server SCOPE=Session ID=MyAd PROGID="MSWC.AdRotator"&gt;
&lt;/OBJECT&gt;
</CODE></PRE>
<P>You could reference the object <CODE>MyAd</CODE> from any page in the application:</P>
<PRE><CODE>---SOME.ASP---
&lt;%= MyAd.GetAdvertisement("/ads/adrot.txt") %&gt;
</CODE></PRE>
<hr class="iis" size="1">
<p align="center"><em><a href="../../../common/colegal.htm">&copy; 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
</BODY>
</HTML>