notified when a user becomes logged out

Sep 19, 2014 at 7:11 PM
Hello ,
am using ASP.net MVC 5 with Identity 2
Is there a way to be notified when a user becomes logged out with an ASP.net MVC
Note: A user can become logged out without visiting or clicking a "logout" link.
When a user is logged out i want to fetch clear some session related information, and write to a database.
thanks
Developer
Sep 22, 2014 at 9:10 PM
Do you want an explicit notification after the AuthenticationManager.SignOut is called ? Or do you want a notification when the request comes with an expired cookie ?
Oct 7, 2014 at 5:33 PM
Suhasj,
It would be nice to have both situations as on the first we may store how long the user has been using the app, despite it is meaningful or not. On the second we may signal to the user that his/her session is now expired and he/she needs to log in again to continue using the application (for sure, it would be better if we get a notification that the cookie is about to expire).

Regards.