Session.Clear(), Session.Abandon(), Session.RemoveAll()

Often asked by users, how to kill sessions? how to remove sessions?, what is the difference between Session.Clear(), Session.Abandon() and Session.RemoveAll()? which is the best?. etc.

So, here is the full explanation of all methods.

Session.Clear and Session.RemoveAll is like a twin, Both will immediately remove all stored values from session, but the session object still in the memory. In this, Session_OnEnd will not execute/hit.

Session.Abandon in actual it’s not clear the values immediately, it just indicates the session to be abandoned at the end of the current request. We can continue to read the values for the rest of the request. If we write to the session later in the request, the new value will be dropped at the end of the request with no indication. Session_OnEnd executes at the end of the request.


  • To clear Session

  • To remove Session

  • To abandon Session.

As we can see, In Clear and RemoveAll/Remove method  Session immediately remove values from request session wherein Abandon Session values is still in session till the end of a request.

Are you searching for a Dedicated and experienced .NET developer to help you design a visually attractive and interesting website? Identifying your project’s requirements is the first step in outsourcing a .NET developer. It is then simple to determine the amount of education and experience. If the job description is more detailed then it is simpler to locate dedicated .NET Developers in India.

If you are looking to store values in the session, you can find here.

1 Comment

  1. Ali Sandles

    It was helpful. Keep on posting!


Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories