asp.net-mvc - 当 ASP.NET MVC session 过期时注销用户

标签 asp.net-mvc session authentication

在 WCF 服务之一的 ASP.NET MVC 中,我将一个对象放入 HttpContext.Current.Session 对象中。

当 session 超时并且 session 中的所有对象都被清除时,我想注销用户但一直找不到办法。

在 Global.asax 中

当调用 Session_end 方法时,Response 对象和 HttpContext.Current 均为 null。

感谢任何有关如何注销用户的想法。

最佳答案

当 session 超时时,无论如何用户都不再存在。如果您要做的是清理打开的浏览器窗口,则需要根据 session 过期前的剩余时间实现计时器。

SignIn and signout have to do with adding or deleting cookies or tokens to authenticate with an external service. The call that you see should be in the login controller and should not be moved to the global.asax.

无需额外操作。

关于asp.net-mvc - 当 ASP.NET MVC session 过期时注销用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25541704/

相关文章:

javascript - 如何卸载/阻止加载的 JavaScript

php - 在 symfony 中测试 session

django - 选择 session 实现时应该考虑什么?

asp.net-mvc - 在 View 中找不到 webgrid 引用

c# - 为水平表格的列引入分页符

c# - 跟踪广告展示次数(浏览次数)并防止欺诈

android - 如何使用 Ksoap2-Android 使用 Session 依赖的 WCF 服务

authentication - 使用 Firebase 的 authWithOAuthRedirect 时如何避免重定向循环

django - 登录后重定向到另一个页面

php - 使用 Symfony 2.8 中新的 LDAP 组件进行身份验证