Click here to Skip to main content
15,921,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900