Tuesday, September 16, 2008

ASP.NET: Diff between Session's Abandon() & Remove() & Clear()

We all might know the essentials of Session object which is available in the namespace 'System.Web.HttpContext.Current'. But one may or may not know about the difference between the static methods like -
Abandon(), Remove(key) and Clear()

Abandon() - removes current user from the Session and Global.asax's Session_End() will be fired.
Remove(arg) - clears the particular key's value from the session, but the Session for that user will exists.
Clear() - clears all the entries in the Session object of the particular user, but the Session for that user will exists.

No comments: