Determine users currently logged in

Determine users currently logged in

am 13.04.2008 01:54:36 von Benedictum

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?

Re: Determine users currently logged in

am 13.04.2008 02:08:09 von mark

"Benedictum" wrote in message
news:uaytyhPnIHA.1164@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

Re: Determine users currently logged in

am 13.04.2008 16:29:05 von Benedictum

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]" wrote in message
news:ePymupPnIHA.1212@TK2MSFTNGP05.phx.gbl...
> "Benedictum" wrote in message
> news:uaytyhPnIHA.1164@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

Re: Determine users currently logged in

am 13.04.2008 17:49:53 von mark

"Benedictum" wrote in message
news:eTUM8KXnIHA.3400@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&i e=UTF-8&rlz=1T4GZEZ_en-GBGB252GB252&q=%22ASP%2eNET%22+Sessio n%5fEnd


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

Re: Determine users currently logged in

am 17.04.2008 01:08:48 von Benedictum

What happens then when the user just closes the browser? How do handle this?

"Mark Rae [MVP]" wrote in message
news:eyXP93XnIHA.4712@TK2MSFTNGP04.phx.gbl...
> "Benedictum" wrote in message
> news:eTUM8KXnIHA.3400@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&i e=UTF-8&rlz=1T4GZEZ_en-GBGB252GB252&q=%22ASP%2eNET%22+Sessio n%5fEnd
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net

Re: Determine users currently logged in

am 17.04.2008 11:02:35 von mark

"Benedictum" wrote in message
news:u52QWbBoIHA.3748@TK2MSFTNGP05.phx.gbl...

[top-posting corrected again]

> "Mark Rae [MVP]" wrote in message
> news:eyXP93XnIHA.4712@TK2MSFTNGP04.phx.gbl...
>> "Benedictum" wrote in message
>> news:eTUM8KXnIHA.3400@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&i e=UTF-8&rlz=1T4GZEZ_en-GBGB252GB252&q=%22ASP%2eNET%22+Sessio n%5fEnd
>
> 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...


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