如何将更新 Lastactivitytime 集成到 .NET FormsAuthentication 流程中?
基本上,我试图向我继承的项目添加对跟踪在线用户的支持,该项目具有自定义 MembershipProvider 和 RoleProvider 并使用 FormsAuthentication。 除了我将继续更新上次活动时间的方法之外,我已经弄清楚了所有事情。 我想要执行此操作的方法是每次 .NET 检查是否允许用户访问他们尝试加载的页面(基于角色,在 Web.config 中定义)时更新 lastactivitytime,但我可以不太清楚我到底应该在哪里插入这个位。
我知道 MembershipProvider.GetUser() 有一个更新 Lastactivitytime 的选项,并且我已经尝试在其中插入我的小更新例程,但它似乎根本没有被调用。 我对 .NET 还很陌生,在文档中挖掘了一个多小时没有给我提供任何答案,所以如果有人能为我提供关于 .NET 如何准确检查用户是否是的答案,我将不胜感激已验证。
Basically, I'm trying to add support for tracking online users to a project I've inherited, which has a custom MembershipProvider and RoleProvider and uses FormsAuthentication. I've pretty figured out everything except the means by which I'm going to keep updating the lastactivitytime. The way I'd like to do this would be to just have lastactivitytime updated each time .NET checks whether the User is allowed to access whichever page they are trying to load (based on Roles, defined in Web.config), but I can't quite figure out where exactly I'd insert this bit.
I'm aware that MembershipProvider.GetUser() has an option to update lastactivitytime, and I've already tried inserting my little updating routine in there, but it doesn't seem to get called at all. I'm pretty new to .NET and digging for over an hour in the documentation hasn't provided me with any answers, so I'd be grateful if anybody could provide me with an answer on how exactly .NET checks whether a user is authenticated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许这不是优雅的方式,但我们在母版页上为注册用户分配了一个小型ajax小部件,该小部件每分钟“ping”一次服务器。 它对于显示用户统计数据或显示有关新消息到达的图标非常有用。
因此,此服务会更新会员提供商中的活动时间
May be it is not elegant way, but we allocated for registered users on the master page small ajax widget, that 'pings' server once per minute. It is useful for displaying user statistic or show icon about new message arrived.
So this service updates activity time in Membership provider