Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

ASP Session.Contents Collection

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The ASP Session.Contents Collection is used for collecting the items which are appended to the Application object by using script command.  This Collection can also be used to provide a list of items that have been given session scope,  

We can use the Contents.Remove and Contents.RemoveAll methods to remove some or all of the items from the collection.   

Syntax:

Session.Contents(Key) 

Parameter Values:

  • Key: It contains a single value i.e Key which represents the name of the items.

Example-1: We used to add names and objects that would be added to the contents collections.

ASP




<%
Session("name")="Hege"
Set Session("objtest")=Server.CreateObject("ADODB.Connection")
%>

Example-2: 

ASP




<%
Session("Name")="Akku"
Session("Favourite Gane")="Cricket"
  
for each x in Session.Contents
 Response.Write(x & "=" & Session.Contents(x) & "<br>")
next
%>

Output:

Name = Akku 
Favourite Game = Cricket 
My Personal Notes arrow_drop_up
Last Updated : 03 Mar, 2021
Like Article
Save Article
Similar Reads
Related Tutorials