ASP 콘텐츠 컬렉션
❮ 완전한 애플리케이션 객체 참조
Contents 컬렉션은 스크립트 명령을 통해 애플리케이션/세션에 추가된 모든 항목을 포함합니다.
팁: Contents 컬렉션에서 항목을 제거하려면 Remove 및 RemoveAll 메서드를 사용합니다.
통사론
Application.Contents(Key)
Session.Contents(Key)
Parameter | Description |
---|---|
key | Required. The name of the item to retrieve |
응용 프로그램 개체의 예
실시예 1
Contents 컬렉션에 name과 objtest가 모두 추가됩니다.
<%
Application("name")="W3Schools"
Set Application("objtest")=Server.CreateObject("ADODB.Connection")
%>
실시예 2
Contents 컬렉션을 반복하려면:
<%
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
%>
실시예 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
세션 개체의 예
실시예 1
Contents 컬렉션에 name과 objtest가 모두 추가됩니다.
<%
Session("name")="Hege"
Set Session("objtest")=Server.CreateObject("ADODB.Connection")
%>
실시예 2
Contents 컬렉션을 반복하려면:
<%
for each x in Session.Contents
Response.Write(x & "=" & Session.Contents(x) & "<br>")
next
%>
or:
<%
For i=1 to Session.Contents.Count
Response.Write(i & "=" & Session.Contents(i) & "<br>")
Next
%>
실시예 3
<%
Session("name")="Hege"
Session("date")="2001/05/05"
for each x in Session.Contents
Response.Write(x & "=" & Session.Contents(x) & "<br>")
next
%>
Output:
name=Hege
date=2001/05/05
❮ 완전한 애플리케이션 객체 참조