Barbaros Alp
Barbaros Alp

Reputation: 6434

Get currently online users?

After googling a bit I have found some tips about how to get online Users with ASP.NET. But I am using my own class for membership.

The information I have found is:

  1. Log the users sessionId to database when the user logs in
  2. Log them out when their session time out

What is your advice about this?

Upvotes: 0

Views: 1377

Answers (2)

Barbaros Alp
Barbaros Alp

Reputation: 6434

I have found this great article

Hope helps someone

Upvotes: 1

Fabian
Fabian

Reputation: 146

We use this approach at work so that when users upload data in separate but concurrent session to a webservice, we can catch 90% of the cases where timeout has occurred and warn the user then and there.

We don't catch every case because:

  • Session timeout event handler in global.asax isn't reliably called the moment expiration occurs (IIRC)
  • The user could have closed their browser window in the mean time.

Two common approaches of which I am aware are:

  • Any user action causes an update to LastActionTime in the users table. Using this value + 20 minutes (or whatever your session timeout value) is a pretty good indication of who is logged in
  • A small AJAX panel updating every few seconds (linked with the previous option).

Upvotes: 0

Related Questions