Skip to content
Related Articles

Related Articles

ASP Session.Contents.Remove Method
  • Last Updated : 27 Jan, 2021
GeeksforGeeks - Summer Carnival Banner

The Session.Contents.Remove Method  in ASP is used to remove an item from Session Contents collection. It is a predefined method of the Session type Object.

Syntax  

Session.Contents.Remove(name|index) 

Parameter Values: It contains the value i.e name which represents the index of the specified items that would be removed from the Session. 

Example: Below code illustrates how to remove the third item from the content list. 

<%
Session("item1")=("Geeks")
Session("item2")=("For")
Session("item3")=("Geeks")
Session("item4")=("sudo")


Session.Contents.Remove(3)

for each x in Session.Contents
 Response.Write(x & "=" & Session.Contents(x) & "<br>")
next
%>

Output 

 item1= Geeks
 iten2=For
  item4=Sudo 

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :