且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

保护ASP.NET应用程序使用限制登录次数

更新时间:2022-11-06 08:43:49

我会使用的SessionID在Session对象为重点,我想存储的用户名进行登录的用户在数据库或某种沿的后备存储。我会使用Session_End中在Global.asax删除记录上述任何一届会议即将过期,并在任何注销功能删除它们。你应该觉得很简单,算你有,并确认它不是在同一个用户登录一次,如果这是允许的活动会话的数量。

I would use the SessionID in the Session object as the key, I'd store that along with the UserID for the logged in user in a database or some kind of backing store. I'd use Session_End in the global.asax to remove the records above for any session expiring and also remove them in any logout function. You should find it fairly simple to count the number of active sessions you have and confirm that it's not the same user logging in again, if that's allowed.