By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,497 Members | 1,287 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,497 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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" <tp****@discussions.microsoft.com> wrote in message
news:03**********************************@microsof t.com...
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.

Nov 19 '05 #2

P: n/a
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" <tp****@discussions.microsoft.com> wrote in message
news:03**********************************@microsof t.com...
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.


Nov 19 '05 #3

P: n/a
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 ***
Nov 19 '05 #4

P: n/a
Fx
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
Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.