Search code examples
c#asp.netasp.net-mvcowinkatana

Make some clean up after user automatically logged out in Asp.Net Identity


I am using ASP.NET Identity 2.0 in ASP.NET MVC 5 application and for some reason I am storing some data in database which has to be cleaned after the user is logged out. I set ExpireTimeSpan = TimeSpan.FromMinutes(sessionTimeOut) property in CookieAuthenticationProvider but I need to execute a method after the TimeSpan has expired. I tried to add Session_End method in Global.asax but did not work.

Is there any way to execute a callback function when the user is automatically logged out from the system ?


Solution

  • As @Tommy and @Kevin B Burns recommended I could not find a specific solution provided from ASP.MVC itself but ended up using Quartz.NET job scheduler to execute for a specific time to make the clean up in database.