How to clear session in mvc 5 global.asax

How to clear session in mvc 5 global.asax

We can clear the session on global level in mvc 5 using  Session_End() in global.asax. The below example might help you for clear the session and abandon session in the global levels.

1. Session.Clear(); // for clear sessions.
2. Session.Abandon(); // for abandon sessions.
//End the application sessions.

private void Session_End(object sender, EventArgs e) { Session.Clear(); Session.Abandon(); }


Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog -
My Books - Book 1 and Book 2 Powered by Blogger.