How to know if a user is log in ?

  • Thread starter Thread starter Metallica
  • Start date Start date
M

Metallica

Hi,

I need same samples or codes that show exactly how can i know if a user is
already logged in the system.

I use formsatuthentication, the point of all my trouble, is that:

If one login is already in use, someone that try to log in, will give to him
a msg telling that this user is already connect on my system. i need do
that, but i try use array list on my global.asax, but dosent work well...

some excamples ?
 
I realize that onSessionStop may not give you the behaviour you want but
together with a logout function you could use the Database to persist active
users.

Your login function which checks db credentials can check that table of
logged in users for the current user's ID, if found, return false and do not
Log the user in.

As far as cleaning up that table so that people can log in when they want,
check the onSessionStop for the User.Identity maybe, and allow a logout
function to clean that table out as well.

Hitting the database is not always optimal in most cases but you mentioned
Global.asa doesnt do the job for you so you must think about other
persistance methods.

Note: you may wish to clean all records from that table OnApplicationStop
 
Back
Top