O'Reilly logo

ASP in a Nutshell, 2nd Edition by A. Keyton Weissinger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required