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. ASP.NET Provides below methods to clearing or removing Session information. 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 Session.Clear () Vs. Session.RemoveAll()Let’s assume stored below information with in session variable.
now, if you want to remove all the items from session you can use either Session.RemoveAll() or Session.Clear(). if you check the definition from meta data file you will get below details, where description says the same.
Read more: Beyond Relational
QR:
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 Session.Clear () Vs. Session.RemoveAll()Let’s assume stored below information with in session variable.
Read more: Beyond Relational
QR:
0 comments:
Post a Comment