限制同一用户从另一台PC同时登录

问题描述:

我在一台服务器上托管了一个ASP.Net Web应用程序.

我想限制同一用户通过网络连接登录到不同的计算机上,但必须满足某些条件.
因此,我想到了将三个新列添加到User表中,以便我们可以跟踪同一用户是否在同一台或不同的计算机上登录.
这些列就像:

IsLoggedIn:检查特定用户是否已经登录.
会话ID:检查是否打开了相同的用户实例.
IP地址:检查同一用户是在同一台PC上还是在不同PC上.

这应该满足以下一些条件,但不能满足其中一些条件.

条件如下:-

1)两台计算机都在同一局域网中.

2)每台计算机都从不同位置通过Internet访问该软件.

3)每台计算机都从同一位置通过Internet访问该软件.

4)托管的某些应用程序意味着,单独的IP地址不是区分不同网络计算机的可接受方法.

5)有些用户只是关闭浏览器而不注销.

有人可以建议如何完成所有这些条件以满足我的申请吗?
主要是第4和第5.

在此先感谢一下.

I am having a ASP.Net Web application hosted on one server.

I want to restrict same user to login on different machines over the network connection but with certain conditions to be satisfied.
So i thought of adding three new columns to the User table so that we can track if same user is logged in on same or different machines.
Those columns are like :

IsLoggedIn : To ckeck if the particular user is already logged in or not.
Session ID : To check if the same user instance is opened.
IP Address : To check if the same user is on same or different PCs.

This should satisfy some of the below conditions, but it fails to satisfy some of them.

Conditions are as follows :-

1) Both computers are on the same LAN.

2) Each computer is accessing the software over the internet from different locations.

3) Each computer is accessing the software over the internet from the same location.

4) Some of the application hosted which means that IP address alone is not an acceptable way to distinguish differnet computers.

5) Some users just close the browser without logging out.

Can anybody suggest how to accomplish all these condtions to satisfy with my application ?
Mainly 4th and the 5th .

Thanks in advance.

关于第五点,您需要确保如果用户已登录,则会话超时-假设为15分钟.并阻止用户登录15分钟.如果用户做了一些工作,请增加数据库中的会话时间(如滑动到期).这样,您只存储用户的上次激活时间,如果超过15分钟,则将其进行比较.如果少于15分钟,请提示用户他/她必须等待X分钟(其中X是使会话过期的剩余分钟).第15分钟后,您可以允许用户.
For the 5th point, you need to make sure that if the user has logged in, keep a session timeout of - lets say 15 minutes. And block the user from logging in for 15 minutes. If the user does some work, increase the session time (like sliding expiration) in the database. In that way you just store the last active time of the user and compare it if it is greater than 15 minutes. If it is less than 15 minutes, prompt the user that he/she has to wait for X minutes (where X is the remaining minutes to expire the session). After the 15th minute, you can allow the user.