窗体身份验证超时记录 [英] Forms Authentication Timeout Logging

查看:156
本文介绍了窗体身份验证超时记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要当一个asp.net窗体身份验证票证已过期检测。然后我想登录到服务器这是因为闲置注销用户。是否有当验证票证已过期服务器?

I want to detect when a asp.net Form Authentication ticket has expired. I then want to log to the server the user that was signed out because of inactivity. Is there an event that fires on the server when the authentication ticket has expired?

<sessionState mode="InProc" timeout="5"></sessionState>
<authentication mode="Forms">
  <forms loginUrl="~/Home/AccessDenied" timeout="5" />
</authentication>

在全球ASAX文件,我已经试过的Session_OnEnd()。但context.user对象为null。当我打电话membership.getuser()返回null也。我试图使AUTH之前会话超时,但是这并不能帮助。我使用MVC3和ii7.5。

In the global asax file, I have tried the Session_OnEnd(). But the context.user object is null. When i call membership.getuser() it returns null also. I have tried making the session timeout before the auth but that doesn't help. I am using mvc3 and ii7.5.

推荐答案

会话和窗体身份验证有两个完全独立的超时。
看到这我在这里的帖子:

Session and forms authentication have two completely separate timeouts. See my posting on this here:

<一个href=\"http://stackoverflow.com/questions/7586469/how-can-i-handle-forms-authentication-timeout-exceptions-in-asp-net\">How我可以处理窗体身份验证超时异常,在ASP.NET?

在Application_ preRequestHandlerExecute你需要检查的车票。

In Application_PreRequestHandlerExecute you need to check the ticket.

另外要的确定的会话和窗体身份验证超时使用code我张贴有同步。不只是如果二者都是说60分钟。由于直到一半的时间的推移,和会话时间更新在每次请求窗体身份验证不更新的'感动'的时候,他们不同步。

Also be sure your session and forms auth timeouts are in sync using the code I posted there. Not just setting both to say 60 minutes. Since forms auth doesn't update the 'touched' time until half of the time passes by, and session time is updated on every request, they get out of sync.

这篇关于窗体身份验证超时记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆