
414
|
Chapter 19: The HttpSessionState Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
accessed via the Contents property in classic ASP. In new ASP.NET development,
you should access these members directly.
Keys
KeysCollection = Session.Keys
Returns a NameObjectCollectionBase.KeysCollection containing the string keys
associated with all of the values stored in the Session collection.
Parameter
KeysCollection
A variable of type NameObjectCollectionBase.KeysCollection that will
receive the Keys property value.
Example
The example loops through the collection of keys in the Session collection and
then displays the key name and the value associated with it by using the Text
property of the Message label control:
Sub Page_Load( )
Dim Key As String
Message.Text = "Session Keys:"
For Each Key in Session.Keys
Message.Text &= "<br/>Key: " & Key
Message.Text &= "<br/>Value: " & _
CStr(Session(Key))
Next
End Sub
Notes
The Keys property provides one of many ways to iterate over the contents of the
Session collection.
StaticObjects
HttpStaticObjectsCollection = Session.StaticObjects
Returns an HttpStaticObjectsCollection containing all objects instantiated in
global.asax by using the
<object runat="server"> syntax whose scope is set to
Session.
Parameter
HttpStaticObjectsCollection
A variable of type HttpStaticObjectsCollection ...