473,725 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1451
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****@discuss ions.microsoft. com> wrote in message
news:03******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. com> wrote in message
news:03******** *************** ***********@mic rosoft.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.NE T
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
6502
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 "how many users online" issue. I am looking at two different sites where I am looking into implementing this type of script; one that has mySQL and one that has no db access of any kind; both use PHP 4.1.
10
3689
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. Andrew dalke@dalkescientific.com
14
2526
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
1880
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 the health information at the level we want. QUESTION: Can we shut those off?? Any other suggestions?? Paul Sullivan
5
10335
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 "Add Web Reference" for the same service the same function works appropriately. Here is the client proxy generated from WSDL.exe <System.Web.Services.Protocols.SoapDocumentMethodAttribute("capeconnect:AppSec:AppSecPortType#getApplicationUsers",
2
4650
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 with that key has already been registered, I can't register another block with the same key. So the problem is, if I have functions that just register script blocks, am I going to have to dynamically generate keys for each one with some kind of...
1
6500
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" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
15
1819
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" on using such keywords/functions from ISO C in an IDE I am working on. So I would bring up a function and use the current word as the search criteria to locate an online library/faq e.g
10
2302
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? It says 14 guest now, and i am logged in so it sould ream me as member..... And how do i make a cron job, the tutorial says it lowrs site badwith and it runs better updating records?
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.