Click here to Skip to main content
15,887,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,

I want to know , if i am logged in application , and i am trying to loggin into another session with same username and password, i want the earlier logged in session should logout automatic and allow me to logged in recent session. anybody can help me out.
Posted

Maintain 'LastLoggedIn' datetime field or 'IsAlreadyLoggedIn' flag in your DB. Once someone log's in, populate the flag that user is logged in. Along with authentication, pass on certain key along with it such that you can check if the current login has the current key or not.
If it matches, let the execution move ahead. If not then forcefully log the user out with message that you logged in somewhere else.
 
Share this answer
 
use IP's if your talking about different locations logging in, or you can have a flag in database or something to hold a session variable name and when its logging in again - delete the old session variable name with the value u took from the database.

basically
login_click(){
   Session.Contents.Remove(sqlConn.ExecuteScalar("select SessionVarName from UserTable where userid = '" + txtLoginID + "'");
}
 
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