"Ron J" <rj******@atsecure.netwrote in message
news:eN**************@TK2MSFTNGP03.phx.gbl...
I would like to keep track of users when they are 'on'. On Session_Start I
can write a DB record about them, but there does not seem to be session
variable information during the Session_end event which I could use to
update the record that they are logged out. This would also be nice to
limit multiple logins.
Is there a preferred way to track users login / logout /session time and
multiple logins ?
Session_End fires only when using inproc sessions.
If you're using inproc sessions, you can use Session_End to update a
database etc. When a session begins, store the userid of the user logging in
as a session variable, and it will be available to use in Session_End.
HOWEVER...
Session_End fires when the session ends. This means that you will need to
tear the session down through code i.e. by means of a "Logout" button -
otherwise, Session_End will fire when the session times out naturally, by
default after 20 minutes of inactivity. Session_End does *not* fire if the
user simply closes their browser etc...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net