Last post Feb 21, 2017 06:00 AM by Cathy Zou
Feb 21, 2012 03:42 AM|bhupender|LINK
how to Prevent Multiple Concurrent User Logins For The Same UserName
Feb 21, 2012 03:49 AM|ignatandrei|LINK
add a field named : already logged in
On session_Start put a value (1)
on session_end clear the value(0)
if it is 1 do not permit logging again
Feb 21, 2012 04:07 AM|bhupender|LINK
Thanks ignatandrei for reply.i required actully only one login allowed at same time. if a user login with the same credential it allow to logged in the user but if another user is
already logged in with the credential it automatically loged out at the same time. please advice its very urgent.
Feb 21, 2012 05:41 AM|CharyXNS|LINK
Sample code will be as follows -
in the Login Page -> Before validating the user check
List<string> userList = null;
if(Application["Users"] == null)
userList = new List<string>();
userList = Application["Users"] as List<string>();
//Do this after User is validated
return "User already logged-in";
Application["Users"] = userList;
Feb 21, 2012 06:19 AM|bhupender|LINK
thanks for the reply ,but when a user try to login with same login id and password then it allowed to be login and othe user who have already login is sign out autometically.
Apr 09, 2012 05:35 PM|hashmisf|LINK
Store the session object in List along with User Id/Name and if you find that user already logged in you can invalidate the previous session and insert/update new session object.
Feb 21, 2017 06:00 AM|Cathy Zou|LINK
You Can do it by many ways, simple approach is
1.Set one flag at the time of login into database.
2.Check flag every time when you are sign in.
3. Remove flag at time of logout.
You also could use the way in the following link: