C# CookieAuthenticationOptions,注销时的自定义操作
我有一段代码:C# CookieAuthenticationOptions,注销时的自定义操作,c#,asp.net-mvc-5,owin,C#,Asp.net Mvc 5,Owin,我有一段代码: app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, ExpireTimeSpan = TimeSpan.FromSeconds(5), CookieSecure = CookieSecure
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
ExpireTimeSpan = TimeSpan.FromSeconds(5),
CookieSecure = CookieSecureOption.Never,
CookieHttpOnly = false,
SlidingExpiration = true,
LoginPath = new PathString("/Account/Login")
});
我试图做的是在cookie过期时执行一个操作(将一些信息记录到db),从而注销用户。我试图通过LogoutPath实现这一点,但我意识到它并没有达到我的预期
有没有办法在cookie过期时注入操作?在较新的MVC项目中,global asax中的会话结束仍然是一件事吗?我不这么认为。。。客户端浏览器会删除过期的cookie,但不会将其发送到服务器。这很有意义-身份验证设置中是否有一种简单的方法允许我跟踪此情况?我不想编写一些监控用户会话和活动的代码。。。