BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
Microsoft ASP
The Session.Abandon Method
The Session.OnStart() Event
The Session.OnEnd() Event
The Session Object
The Server.ScriptTimeOut Property
The Server.URLEncode Method
The Server.Transfer Method
The Server.MapPath Method
The Server.HTMLEncode Method
The Server.GetLastError Method
The Server.Execute Method
The Server.CreateObject Method
The Server Object
The Response.Status Property
The Response.PICS Property
The Response.LCID Property
The Response.IsClientConnected Property
The Response.ExpiresAbsolute Property
The Response.Expires Property
The Response.Cookies Property
<< LAMP
 

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :224

 

The Session.Contents.Remove(name|index) Method

Introduction

The Session.Contents.Remove() method can be used to remove specific items from an session object. You can either pass the name of the item or the index of the item. Please consider that when you pass an integer as a parameter then all other items in the list will be automatically updated and it is recommend passing always the name as a parameter.

Example

<%

            ' Initialization

            Session("name") = "sonu"

            Session("age") = "XX"

            Session("location") = "montreal"

            ' Show all items before removing

            Response.Write "<b>Before Removing:</b><br/>"

            For Each Key in Session.Contents

                        Response.Write Key + " = " + Session(Key) + "<br/>"

            Next

            ' Remove the item by passing the item name

            Response.Write "<br/><b>Remove by passing the item name:</b><br/>"

           

            Session.Contents.Remove("age")

            Response.Write "<b><i><font color=red>"

            Response.Write "As you can see item 2 has been removed and item 3 is now at the place of item 2.<br/>"

            Response.Write "So be careful when you delete the items from the collection"

            Response.Write "</font></i></b><br/>"

            ' Show all items after removing

            For Each Key in Session.Contents

                        Response.Write Key + " = " + Session(Key) + "<br/>"

            Next

            ' Remove the item by passing the index

            Response.Write "<br/><b>Remove by passing the index:</b><br/>"

            Session.Contents.Remove(2)

            ' Show all items after removing

            For Each Key in Session.Contents

                        Response.Write Key + " = " + Session(Key) + "<br/>"

            Next

%>

Output


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C
Immediate ASP.NET/C# Openings for C

View all Jobs (Add yours)
View all CV (Add yours)



bigfoot conferencing
swimming pool contractor
saveonconferences uk rates
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP