473,395 Members | 1,577 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,395 software developers and data experts.

why does the amount of visitors not decrease?

Hi,

i want to get the amount of visitors online.
I did this in global.asax

I tested it by opening several browser sessions.
The amount increases, but never decreases, when i close some browsers.
I have heard of 'session.abandon' but have no idea where to put it (not in
Sub Session_End because it's not fired)
I don't want to use the session.timeout.

My web.config doesn't contain any session state of any kind.

Thanks for hints
Chris
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("visitors") = 0
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("visitors") = Application("visitors") + 1
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Application("visitors") = Application("visitors") - 1
End Sub
Jun 8 '07 #1
4 2224
"Chris" <cc@dd.ddwrote in message
news:OB**************@TK2MSFTNGP04.phx.gbl...

Session_End fires when the session ends.

Closing the browser does *not* cause the session to end - this a very common
misconception.

If you want the number to decrease, you will have to force Session_End to
fire by calling Session_Abandon() - the usual way to achieve this is to have
some sort of "Log Out" button, but there is nothing you can do if the user
simply closes their browser...
--
http://www.markrae.net

Jun 8 '07 #2
Thanks for replying ..

Where have i do put that Session.abandon?
I mean: in which event (Page_UnLoad ?)
Thanks
"Mark Rae" <ma**@markNOSPAMrae.netschreef in bericht
news:ON*************@TK2MSFTNGP02.phx.gbl...
"Chris" <cc@dd.ddwrote in message
news:OB**************@TK2MSFTNGP04.phx.gbl...

Session_End fires when the session ends.

Closing the browser does *not* cause the session to end - this a very
common misconception.

If you want the number to decrease, you will have to force Session_End to
fire by calling Session_Abandon() - the usual way to achieve this is to
have some sort of "Log Out" button, but there is nothing you can do if the
user simply closes their browser...
--
http://www.markrae.net

Jun 8 '07 #3
"Chris" <cc@dd.ddwrote in message
news:eo**************@TK2MSFTNGP02.phx.gbl...
Where have i do put that Session.abandon?
I mean: in which event (Page_UnLoad ?)
You seem to be getting a bit confused with how ASP.NET pages work...

Page_Unload fires just after the page has been rendered into HTML and
streamed down to the client, not when the user closes the page:
http://msdn2.microsoft.com/en-us/library/ms178472.aspx
Do you have on-line banking? If so, then that website will (almost)
certainly have a "Log Out" button or hyperlink which they encourage you to
click rather than just closing your browser or moving to a different site -
the Session_Abandon() method goes there...

There is no way whatsoever for ASP.NET to know that a user has closed their
browser...
--
http://www.markrae.net

Jun 8 '07 #4
Ok, thanks again

"Mark Rae" <ma**@markNOSPAMrae.netschreef in bericht
news:ua**************@TK2MSFTNGP04.phx.gbl...
"Chris" <cc@dd.ddwrote in message
news:eo**************@TK2MSFTNGP02.phx.gbl...
>Where have i do put that Session.abandon?
I mean: in which event (Page_UnLoad ?)

You seem to be getting a bit confused with how ASP.NET pages work...

Page_Unload fires just after the page has been rendered into HTML and
streamed down to the client, not when the user closes the page:
http://msdn2.microsoft.com/en-us/library/ms178472.aspx
Do you have on-line banking? If so, then that website will (almost)
certainly have a "Log Out" button or hyperlink which they encourage you to
click rather than just closing your browser or moving to a different
site - the Session_Abandon() method goes there...

There is no way whatsoever for ASP.NET to know that a user has closed
their browser...
--
http://www.markrae.net

Jun 8 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Eric | last post by:
I need an effective way (time is my main concern here) to generate 10 000 000 unique alphanumeric strings of 16 characters each. I used STL set and map but after about 5 000 000 entries, it...
31
by: bilbothebagginsbab5 AT freenet DOT de | last post by:
Hello, hello. So. I've read what I could find on google(groups) for this, also the faq of comp.lang.c. But still I do not understand why there is not standard method to "(...) query the...
11
by: OldProgrammer | last post by:
All the documentation and discussion I have read indicate that the Session_End is not supposed to fire unless you are in "inProc" Session state mode, and then only on Session Timeout or at Session...
0
by: ip2location.inc | last post by:
IP2Location has announced the availability of IP2Location .NET Component, that enables application developers to geolocation the Internet visitors by IP Address from their .NET applications. ...
3
by: johnny | last post by:
hi all! I am starting to study the best way to track site visitors. Logfiles stats which come with every web hosting, have little metrics to be analyzed and also problems with cached pages which...
18
by: damezumari | last post by:
I would like to know how many of the visitors to my site has js enabled and how many has it turned off. I haven't found a simple solution searching Google groups so I suggest the following using...
17
by: christophe.chazeau | last post by:
Hi, I have a problem with a really simple chunk of code which should work but does obviously does not. This chunk of code is just a POC aimed at finding a bug in a larger project in which the...
4
by: Hong Chen | last post by:
I developed a large program and found the program does not really release memory after the delete operation is taken, since, according to "performance monitor", the virtual bytes used by this...
10
by: r_ahimsa_m | last post by:
Hello, On index.html page I have a table with id="property_fields". <table id="property_fields" name="property_fields" border="0"> It contains set of rows with the following IDs: var...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.