ASP Session.Contents.Remove Method
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
Last Updated :
27 Jan, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...