The Contents collection contains all session variables.

It is possible to remove a session variable with the Remove method.

The example below removes the session variable "sale" if the value of the session variable "age" is lower than 18:

<%
If Session.Contents("age")<18 then
  Session.Contents.Remove("sale")
End If
%>

To remove all variables in a session, use the RemoveAll method:

<%
Session.Contents.RemoveAll()
%>



Practice Excercise Practice now