|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.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
|file: /Techref/language/asp/obj/ref_vbom_apoccc.htm, 4KB, , updated: 2003/5/15 13:13, local time: 2019/2/23 16:25,
|©2019 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://www.piclist.com/techref/language/asp/obj/ref_vbom_apoccc.htm"> Application.Contents Collection</A>
|Did you find what you needed?|
PICList 2019 contributors:
o List host: MIT, Site host massmind.org, Top posters @20190223 RussellMc, David Van Horn, Neil, AB Pearce - UKRI STFC, David C Brown, Allen Mulvey, Denny Esterline, James Cameron, mike brown, Jim,
* 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 www.piclist.com!