Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Need help keeping track of users "online" (i.e. viewing the web si

Reply
Thread Tools

Need help keeping track of users "online" (i.e. viewing the web si

 
 
=?Utf-8?B?dHBlcnJp?=
Guest
Posts: n/a
 
      07-11-2005
I've got a user table with a field called Online, and when a user logs in, I
set a value in this column to indicate they are online. And in the same
fashion, when they click the logout button, I update this same field to
indicate they are offline.

However, how do I handle this when a user just X's out of the browser
without logging off? I've set break points in the global.asax.cs file but
the Session_End and Application_End functions never get executed if the
browser is closed.

Can anyone recommend a better solution for me, or tell me how to execute
updating my code to set a user offline if someone exits closing the browser
or navigating away from my page?

Thanks for the help.
 
Reply With Quote
 
 
 
 
John Timney \(ASP.NET MVP\)
Guest
Posts: n/a
 
      07-11-2005
Session end doesn't happen when the browser closes, it happens when the
server times out the session due to session inactivity. Are you perhaps
expecting the session end to fire on browser close?

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"tperri" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've got a user table with a field called Online, and when a user logs in,
> I
> set a value in this column to indicate they are online. And in the same
> fashion, when they click the logout button, I update this same field to
> indicate they are offline.
>
> However, how do I handle this when a user just X's out of the browser
> without logging off? I've set break points in the global.asax.cs file but
> the Session_End and Application_End functions never get executed if the
> browser is closed.
>
> Can anyone recommend a better solution for me, or tell me how to execute
> updating my code to set a user offline if someone exits closing the
> browser
> or navigating away from my page?
>
> Thanks for the help.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?dHBlcnJp?=
Guest
Posts: n/a
 
      07-11-2005
Actually I'm looking for anything that fires when the browser is closed or my
page is navigated away from.

Can you point me in the direction of what I'm looking for?

Thanks for your response

"John Timney (ASP.NET MVP)" wrote:

> Session end doesn't happen when the browser closes, it happens when the
> server times out the session due to session inactivity. Are you perhaps
> expecting the session end to fire on browser close?
>
> --
> Regards
>
> John Timney
> ASP.NET MVP
> Microsoft Regional Director
>
> "tperri" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I've got a user table with a field called Online, and when a user logs in,
> > I
> > set a value in this column to indicate they are online. And in the same
> > fashion, when they click the logout button, I update this same field to
> > indicate they are offline.
> >
> > However, how do I handle this when a user just X's out of the browser
> > without logging off? I've set break points in the global.asax.cs file but
> > the Session_End and Application_End functions never get executed if the
> > browser is closed.
> >
> > Can anyone recommend a better solution for me, or tell me how to execute
> > updating my code to set a user offline if someone exits closing the
> > browser
> > or navigating away from my page?
> >
> > Thanks for the help.

>
>
>

 
Reply With Quote
 
Patrick Olurotimi Ige
Guest
Posts: n/a
 
      07-12-2005
tperri..
Try seeing this artcile it should give you some hints:-
http://aspnet101.com/aspnet101/tutorials.aspx?id=16
Hope it helps
Patrick


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
=?Utf-8?B?Rng=?=
Guest
Posts: n/a
 
      07-12-2005
Hi
not sure if this was answered in the link Patrick gave as I couldn't follow
the link

here's something to try
Set Session.Timeout = 2 in the Session Start Event
In your Session End event add in a few dummy lines of code and set a break
point
Now start in debugging mode and either leave your browser on the page that
comes up or navigate to a different site altogether
switch back to VisualStudio.NET
wait 2 minutes then hey presto the break point should be hit
If you want to use any session variables in the End event just initalise
them in the the start event, if you dont they seem to go missing

It also works for when users X out of the browser

Cheers

Felix
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keeping track of users LogIn Eric S ASP .Net 5 03-02-2010 08:29 PM
Keeping track number of users using an application Jack ASP General 1 02-24-2006 06:52 PM
Keeping track of online users Anders Steinlein Java 0 04-20-2004 10:12 PM
Opinions on keeping track of simple web stats with MS SQL Server/ASP.NET Utter Newbie ASP .Net 0 07-28-2003 09:01 PM
Keeping track of which user controls need to be loaded and which not John ASP .Net 0 07-08-2003 09:26 AM



Advertisments