473,386 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
4 1440
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil Powell | last post by:
http://codewalkers.com/seecode/75.html http://www.webkreator.com/php/concepts/counting-users-online-with-php.html The following two URLs illustrate different approaches to the idea of showing...
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
14
by: Brian Maupin | last post by:
I have a refreshing webcam shot on my site and I was wondering if there was a way I could display how many people are currently viewing it? Thanks in advance.
5
by: Paul Sullivan | last post by:
We are a state agency that views protected medical information via our intranet. The screens even have privacy shields. Alarmingly, uses can "Print" and "Save As" which destroys the protection of...
5
by: Mike Logan | last post by:
I used WSDL.exe to generate a client side web proxy for a web service, called the web service, got the results but an array returned by the web service is not in the results. However if I use...
2
by: Alex Maghen | last post by:
Hi. Two questions about "RegisterClientScriptBlock": 1. I want to be able to insert a script block without having to worry about whether the "key" is unique. As it turns out, if a script block...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
15
by: Richard | last post by:
Can anyone recommend a good online resource listing all C keywords, standard system calls, defines etc in a "flat" hierarchy. I wish to set up some bindings in order to bring up "hints and tips"...
10
by: Breana | last post by:
Ok i found this a while back and i am trying to mod it so it works but it keeps not updating the users online and kills my other code? Well i got it working but it dont update when i login?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.