ASP.NET Session is one of most common state management technique for any ASP.NET Web Application. If you want to do a quick refresh or want to know some thing more, please go ahead and read one of my article “Exploring Session in ASP.NET” published at Code Project. ASP.NET provides several methods for removing Session. But which methods needs to use at what time, is a must known stuff for asp.net developer. In this post I going to talk about bit internals of removing session variables from applications. Why this Post ? I found many people having some confusion around removing / clearing the session variable ( Mainly with Session.Clear(), Session.RemoveAll(), Session.Abandon()) , which method needs to use, what is the purpose of particular method etc.
Session.Clear()
Session.RemoveAll()
Session.Abandon()
Session.RemoveAt(index)
Session.Remove(string);
We will be mainly focusing the first 3 methods.
Let’s start with Session.Clear() and Session.RemoveAll(). Well, you may ask, why I am starting with two methods together. Yes, we are in same track. Both Session.Clear() and Session.RemoveAll() does the same job. Let’s explore it
Read more: Abhijit's World of .NET