Session Contents 컬렉션

Session.Contents 컬렉션에는 <OBJECT> 태그를 사용하지 않고 세션을 위해 구성된 모든 항목이 포함됩니다. 컬렉션은 특정 세션 항목 값을 결정하거나 컬렉션 전체를 반복 처리하여 세션의 모든 항목 목록을 검색하는 데 사용할 수 있습니다.

구문

Session.Contents( Key )

매개 변수

Key
검색할 속성 이름입니다.

주의

반복 제어 구조를 사용하여 Contents 컬렉션의 키를 모두 반복할 수 있습니다. 다음 예제를 참조하십시오.

<%@ LANGUAGE="VBSCRIPT" %>
<%
  Dim sessitem
  Dim anArray(2)
  response.write "SessionID: " & Session.SessionID & "<P>"

  anArray(0)="one"
  anArray(1)="second"
  anArray(2)="third"
  Session("anArray")=anArray
  Session("scalar")="1234567890ABCDEFG"

  set objConn=server.createobject("adodb.connection")
  set Session("object")=objConn

  response.write "List of " & Session.Contents.Count & " items in Session
  contents collection:<HR>"
  For Each sessitem in Session.Contents
    If IsObject(Session.Contents(sessitem)) Then
      Response.write(sessitem & " : Session object cannot be displayed." & "<BR>")
    Else
      If IsArray(Session.Contents(sessitem)) Then
         Response.write "Array named " & Session.Content(sessitem) & "<ol>"
         For each objArray in Session.Contents(sessitem)
             Response.write "<li>" & _
             Session.Contents(sessitem)(objArray)& "<BR>"
         Next
             Response.write "</ol>"
      Else
             Response.write(sessitem & " : " & Session.Contents(sessitem) & "<BR>")
       End If
    End If
  Next 
%>

© 1997-2001 Microsoft Corporation. All rights reserved.