116 lines
4.6 KiB
HTML
116 lines
4.6 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>Application Contents Collection</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="_application_contents_collection"></A>Application Contents Collection</H4>
|
|
|
|
<P>The <B>Contents</B> collection contains all the items that have been added to the application through a script command. You can use the <B>Contents</B> collection to obtain a list of items that have been given application scope, or to specify a particular item to be the target of an operation. You can also remove items from the collection with the <B>Remove</B> and <B>RemoveAll</B> methods.</P>
|
|
|
|
<H6>Syntax</H6>
|
|
|
|
<P><B>Application.Contents</B>(<I>Key</I>)</P>
|
|
|
|
<P> </P>
|
|
|
|
<H6>Parameters</H6>
|
|
|
|
<DL>
|
|
<DT><I>Key</I></DT>
|
|
|
|
<DD>Specifies the name of the item to retrieve.</DD>
|
|
</DL>
|
|
|
|
<H6>Methods</H6>
|
|
|
|
<TABLE border=0 cellpadding=5 cols=2 frame=box rules=all>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=50%><A HREF="/iishelp/iis/htm/asp/vbob60kw.htm"><B>Contents.Remove</B></A></TD>
|
|
<TD width=50%>Deletes an item from the collection.</TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=50%><A HREF="/iishelp/iis/htm/asp/vbob1wxc.htm"><B>Contents.RemoveAll</B></A></TD>
|
|
<TD width=50%>Deletes all items from the collection.</TD>
|
|
</TR>
|
|
</TABLE><BR>
|
|
|
|
<H6>Remarks</H6>
|
|
|
|
<P>The <B>Application.Contents</B> collection contains those items that have been declared at the application level without using the <OBJECT> tags. This would include both objects created with <B>Server.CreateObject</B> as well as scalar variables established through an <B>Application </B>declaration. In the following script, for example, both <CODE>strHello</CODE> and objCustom would be members of the <B>Application.Contents</B> collection:</P>
|
|
|
|
<PRE><CODE><%
|
|
Application("strHello") = "Hello"
|
|
Set Application("objCustom") = Server.CreateObject("MyComponent") %>
|
|
</CODE></PRE>
|
|
|
|
<P>The <B>Application.Contents</B> collection supports <B>For...Each </B>and <B>For...Next </B>iteration. The following script illustrates each of these methods of iterating through the <B>Application.Contents</B> collection:</P>
|
|
|
|
<PRE><CODE><%
|
|
Application("strText1") = "1234567890"
|
|
Application("strText2") = "ABCDEFGHIJ"
|
|
Application("strText3") = "A1B2C3D4E5"
|
|
%>
|
|
|
|
<%
|
|
For Each Key in Application.Contents
|
|
Response.Write Key + " = " + Application(Key) + "<BR>"
|
|
Next
|
|
%>
|
|
|
|
<%
|
|
For intItem = 1 to Application.Contents.Count
|
|
Response.Write CStr(intItem) + " = "
|
|
Response.Write Application.Contents(intItem) + "<BR>"
|
|
Next
|
|
%>
|
|
</CODE></PRE>
|
|
|
|
<P>You can see a working sample .asp file that uses the <B>Application.Contents</B> collection in the Building ASP Applications section of the <b>ASP Samples</b> in the IIS section of the Platform SDK or at <a href="http://go.microsoft.com/fwlink/?LinkId=1753" target="_blank">MSDN Online - Internet Information Services</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>
|