Concurrent User and Session Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I build an web application with asp.net and c#. Each user has to login before using it. Once the user uses the login id to login, he will be forced to logout the system if other person uses the SAME login id to login.

I have a log table in database to record which user has login.

But, I am not sure how to monitor the session of the login user.
e.g. how to force the login user to logout the system once other person login it with his same login id

Any suggestion

Thanks
 
You would have to do it on each page request. Just check if someone with the
same ID has logged in (by checking your table).
Then you can delete that user's session variable and redirect them. You
would need to store another ID (you could just store a random number in a
session var) to identify whether it was the same user or not.

How will you remove people from your table though? session variables are
removed (by default) 20 minutes after the last request. You would have to do
something similar to update your table of logged in users.


Tom said:
Hi,

I build an web application with asp.net and c#. Each user has to login
before using it. Once the user uses the login id to login, he will be forced
to logout the system if other person uses the SAME login id to login.
I have a log table in database to record which user has login.

But, I am not sure how to monitor the session of the login user.
e.g. how to force the login user to logout the system once other person
login it with his same login id.
 
I think that I am wrong. I should not use log table to keep logged in user as it requires me update the log table frequently.

I should just use session variables to keep one concurrent user
You would need to store another ID (you could just store a random number in
session var) to identify whether it was the same user or not

Do you have any sample code in C# to handle session id of concurrent user?

Thanks for hel
 
Back
Top