Application.Contents.Remove Method
IIS 6.0
The Contents.Remove method for ASP deletes an item from the Application.Contents collection.
Contents.Remove( id )
The following example adds three items to the Application.Contents collection and removes two. At the end of the example, Application(str3) is the first item instead of the third.
<%@ Language="VBScript" %>
<%
Response.Write("<br/>Before Remove<br/>")
Application.Lock
Application.Contents.Item("str1") = ("First thing")
Application.Contents("str2") = ("Second thing")
Application("str3") = ("Third thing")
Application.Unlock
For Each Key in Application.Contents
Response.Write Key + " = " + Application(Key) + "<br/>"
Next
Response.Write("<br/>After Remove<br/>")
Application.Lock
Application.Contents.Remove("str1")
Application.Contents.Remove("str2")
Application.Unlock
For Each Key in Application.Contents
Response.Write Key + " = " + Application(Key) + "<br/>"
Next
%>
<%@ Language="JScript" %> <% Response.Write("<br/>Before Remove<br/>"); Application.Lock(); Application.Contents.Item("str1") = ("First thing"); Application.Contents("str2") = ("Second thing"); Application("str3") = ("Third thing"); Application.Unlock(); e = new Enumerator(Application.Contents); for (; !e.atEnd(); e.moveNext()) { Response.Write(e.item() + " = " + Application(e.item()) + "<br/>"); } Response.Write("<br/>After Remove<br/>"); Application.Lock(); Application.Contents.Remove("str1"); Application.Contents.Remove("str2"); Application.Unlock(); e = new Enumerator(Application.Contents); for (; !e.atEnd(); e.moveNext()) { Response.Write(e.item() + " = " + Application(e.item()) + "<br/>"); } %>
Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.
Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.
Product: IIS
Caution: