Platform SDK: IIS SDK |
The Session.Contents collection contains all of the items that have been established for a session without using the <OBJECT> tag. The collection can be used to determine the value of a specific session item, or to iterate through the collection and retrieve a list of all items in the session.
Session.Contents( Key)
You can use an iterating control structure to loop through the keys of the Contents collection, as demonstrated in the following example:
<%@ 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
%>
Platforms: Windows 2000 with IIS 5.0 installed,
Windows XP with IIS 5.1 installed,
Windows Server 2003 family with IIS 6.0 installed
What did you think of this topic? |
Order a Platform SDK CD |
file: /Techref/language/asp/obj/ref_vbom_sesoccon.htm, 3KB, , updated: 2003/5/15 13:13, local time: 2024/11/22 16:55,
3.145.33.244:LOG IN
|
©2024 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://techref.massmind.org/Techref/language/asp/obj/ref_vbom_sesoccon.htm"> Session.Contents Collection</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.