在 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/