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