
IsCookieless | 407
SessionState
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Parameter
Integer
An Integer variable that will receive the count property value.
Example
The example adds two values to the Session collection, displays the count of the
items in the Session collection, and then displays each item, using the Count
property as a looping control value:
Sub Page_Load( )
Session("foo") = "Hello, "
Session("bar") = "World!"
Message.Text = "The Session collection contains " & _
Session.Count & " items.</br>"
Dim I as Integer
For I = 0 To Session.Count - 1
Message.Text &= CStr(Session(I)) & "</br>"
Next
End Sub
Notes
The Count property is new for ASP.NET. In addition to using the Count property
for looping through the Session collection, you can use the property to keep track
of how many items a given Session stores at any given time. For example, you
could write this information to a log for later review.
IsCookieless
Boolean = Session.IsCookieless
Returns a Boolean indicating whether the application is configured for cookieless
Session operation.
Parameter
Boolean
A Boolean variable that will receive the IsCookieless property value.
Example
The example displays a message indicating whether cookieless sessions have been
enabled for the current session:
Sub Page_Load( )
If Session.IsCookieless Then
Message.Text = "The current Session ...