Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Determine users currently logged in

0 views
Skip to first unread message

Benedictum

unread,
Apr 12, 2008, 7:54:36 PM4/12/08
to
I need to implement an option to display on the web page for users currently
logged in. How do I implement this in ASP.NET (c#).

I could probably have a boolean field in the database where a user can be
set as logged. This can easily be done in the code-behind. The problem is
how do I "unlogged" the user when the session is timed out?


Mark Rae [MVP]

unread,
Apr 12, 2008, 8:08:09 PM4/12/08
to
"Benedictum" <Bened...@dominusvobis.com> wrote in message
news:uaytyhPn...@TK2MSFTNGP02.phx.gbl...

> I need to implement an option to display on the web page for users
> currently logged in. How do I implement this in ASP.NET (c#).

How are you managing logins...?

> I could probably have a boolean field in the database where a user can be
> set as logged. This can easily be done in the code-behind. The problem is
> how do I "unlogged" the user when the session is timed out?

If you're using inproc sessions, you can write code in the Session_End
event...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Benedictum

unread,
Apr 13, 2008, 10:29:05 AM4/13/08
to
The registered users are authenticated against a datafile. Particulars are
kept in a a seesion var.

Can you show me a code snippet or direct me a tutorial on how to go about
this?
Thanks.

"Mark Rae [MVP]" <ma...@markNOSPAMrae.net> wrote in message
news:ePymupPn...@TK2MSFTNGP05.phx.gbl...

Mark Rae [MVP]

unread,
Apr 13, 2008, 11:49:53 AM4/13/08
to
"Benedictum" <Bened...@dominusvobis.com> wrote in message
news:eTUM8KXn...@TK2MSFTNGP03.phx.gbl...

[top-posting corrected]

>>> I need to implement an option to display on the web page for users
>>> currently logged in. How do I implement this in ASP.NET (c#).
>>
>> How are you managing logins...?
>>
>>> I could probably have a boolean field in the database where a user can
>>> be set as logged. This can easily be done in the code-behind. The
>>> problem is how do I "unlogged" the user when the session is timed out?
>>
>> If you're using inproc sessions, you can write code in the Session_End
>> event...
>

> The registered users are authenticated against a datafile. Particulars are

> kept in a a session variable.

OK, so when a user logs out, remove them from the session variable.

And, when a session times out, remove the user from the session variable
through the Session_End code in global.asax.
http://www.google.co.uk/search?sourceid=navclient&hl=en-GB&ie=UTF-8&rlz=1T4GZEZ_en-GBGB252GB252&q=%22ASP%2eNET%22+Session%5fEnd

Benedictum

unread,
Apr 16, 2008, 7:08:48 PM4/16/08
to
What happens then when the user just closes the browser? How do handle this?

"Mark Rae [MVP]" <ma...@markNOSPAMrae.net> wrote in message

news:eyXP93Xn...@TK2MSFTNGP04.phx.gbl...

Mark Rae [MVP]

unread,
Apr 17, 2008, 5:02:35 AM4/17/08
to
"Benedictum" <Bened...@dominusvobis.com> wrote in message
news:u52QWbBo...@TK2MSFTNGP05.phx.gbl...

[top-posting corrected again]

> What happens then when the user just closes the browser?

Nothing, as far as the webserver is concerned. That's the nature of the
disconnected architecture of the web.

> How do handle this?

You can't...

0 new messages