Platform SDK: IIS SDK |
The Contents collection contains all the items that have been added to the application through a script command. You can use the Contents 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 by using the Remove and RemoveAll methods.
Application.Contents(Key)
Application.Contents.Remove | Deletes an item from the collection. |
Application.Contents.RemoveAll | Deletes all items from the collection. |
The Contents collection contains those items that have been declared at the application level without using the <OBJECT> tags. This would include both objects created by using Server.CreateObject, as well as scalar variables established through an Application declaration. In the following script, for example, both "strHello" and objCustom would be members of the Contents collection.
<%
Application("strHello") =index.html "Hello"
Set Application("objCustom") = Server.CreateObject("MyComponent") %>
The Contents collection supports For...Each and For...Next iteration. The following script illustrates each of these methods of iterating through the Contents collection:
<%
Application("strText1") =index.html "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
%>
You can see a working sample .asp file that uses the Contents collection in the Building ASP Applications section of the Samples.
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_apoccc.htm, 4KB, , updated: 2003/5/15 13:13, local time: 2024/11/22 08:53,
3.15.143.18:LOG IN
|
©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://massmind.org/techref/language/asp/obj/ref_vbom_apoccc.htm"> Application.Contents Collection</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.