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

时间:2017-04-18 11:22:56

标签: c# asp.net asp.net-mvc owin katana

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 ?

1 个答案:

答案 0 :(得分:1)

@Tommy和@Kevin B Burns建议我找不到ASP.MVC本身提供的特定解决方案,但最终使用Quartz.NET作业调度程序执行特定时间以进行清理数据库中。