Example 1
Notice that both name and objtest would be appended to the Contents collection:
<%
Application("name")="W3Schools"
Set Application("objtest")=Server.CreateObject("ADODB.Connection")
%>
Example 2
To loop through the Contents collection:
<%
for each x in Application.Contents
Response.Write(x & "=" & Application.Contents(x) & "<br />")
next
%>
or:
<%
For i=1 to Application.Contents.Count
Response.Write(i & "=" & Application.Contents(i) & "<br />")
Next
%>
Example 3
<%
Application("date")="2001/05/05"
Application("author")="W3Schools"
for each x in Application.Contents
Response.Write(x & "=" & Application.Contents(x) & "<br />")
next
%>
Output:
date=2001/05/05
author=W3Schools |