Name
RemoveAll —
Session.Contents.RemoveAll
Synopsis
Removes all members from the Contents collection. An addition in IIS 5.0, the RemoveAll method allows you to remove from memory all Session-scoped variables without abandoning the Session.
Like the Remove method, the RemoveAll method is an important addition to the Contents collection because it allows for better memory control and cleanup. It allows you to remove all Session-scoped variables without abandoning the session itself.
Parameters
None
Examples
The following script removes all members of the Contents collection:
<% ' This script assumes you have been "carrying around" various form ' variables for an online membership request form. The user has ' filled out the form, she has a username ' and is now a member. Now you would like to remove her form data which ' you stored in Session variables because it was convenient and the ' form's security had to be relatively high. ' strFirstName = Session("strFirstName") ' strLastName = Session("strLastName") . . . Session.Contents.RemoveAll . . . %>
The following script is the first of two ASP scripts that the user
will visit (the first redirects the user's browser to the
second). In this first script, the user's session-level
variables are created (SessionVar1
,
SessionVar2
, and
SessionVar3
).
<HTML> <HEAD><TITLE>Session Contents Example Page1</TITLE></HEAD> <BODY> <% Dim strVar1 Dim strVar2 Dim strVar3 strVar1 = "Session Variable 1" strVar2 = "Session Variable 2" strVar3 = "Session Variable ...
Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.