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

Number of Visitors

Hi I am trying to display on a web page number of visitors on the site. I am
doing this by increasing +1 in global.asax on Session_start and
subtracting -1 on Session_end. I am storing value in the
Application("numberOfVisitors"). It works fine but when I compare values to
number of ASP Applications "Sessions Active" under Windows 2003 performance
chart gives me different values. I am not sure why there is a difference,
and also if there is some better way of doing it? Is it possible in code to
count number of "Sessions Active" and display this instead of adding one and
subtracting one?

Thanks,

Sinisa
Nov 19 '05 #1
5 3522
My guess is the Sessions Active perf counter is higher. If so, that would be
b/c IIS is counting all web visits as a session. For example, if you connect
to the web server to download an image, you won't invoke Session_start &
Session_end, but IIS may still consider your visit a "session".

However, instead of rolling your own visitor tracker, you could instead
write an ASP.NET page that displays any performance counter value you want.
So you could display "Sessions Active", "Current Connections", etc. in a web
page. You would do that via the PerformanceCounter objects in the
System.Diagnostics namespace.

I found a few articles that might help:
http://aspnet.4guysfromrolla.com/articles/041002-1.aspx
http://www.aspheute.com/english/20000809.asp

--
Ben Strackany
www.developmentnow.com
"TheOne" <Th****@noemail.nospam> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
Hi I am trying to display on a web page number of visitors on the site. I am doing this by increasing +1 in global.asax on Session_start and
subtracting -1 on Session_end. I am storing value in the
Application("numberOfVisitors"). It works fine but when I compare values to number of ASP Applications "Sessions Active" under Windows 2003 performance chart gives me different values. I am not sure why there is a difference,
and also if there is some better way of doing it? Is it possible in code to count number of "Sessions Active" and display this instead of adding one and subtracting one?

Thanks,

Sinisa

Nov 19 '05 #2
Actually my counter is showing higher number than performance counter. For
instance It showing 260 on my web page but performance counter is showing 88
for number of active sessions. Is there some reason Session_end is not
getting fired so it is not subtracting -1 for number of sessions? I am using
in memory sessions

Thanks,

Sinisa

"Ben Strackany" <in********@developmentnow.nospam.com> wrote in message
news:eQ**************@TK2MSFTNGP14.phx.gbl...
My guess is the Sessions Active perf counter is higher. If so, that would be b/c IIS is counting all web visits as a session. For example, if you connect to the web server to download an image, you won't invoke Session_start &
Session_end, but IIS may still consider your visit a "session".

However, instead of rolling your own visitor tracker, you could instead
write an ASP.NET page that displays any performance counter value you want. So you could display "Sessions Active", "Current Connections", etc. in a web page. You would do that via the PerformanceCounter objects in the
System.Diagnostics namespace.

I found a few articles that might help:
http://aspnet.4guysfromrolla.com/articles/041002-1.aspx
http://www.aspheute.com/english/20000809.asp

--
Ben Strackany
www.developmentnow.com
"TheOne" <Th****@noemail.nospam> wrote in message
news:O$**************@TK2MSFTNGP10.phx.gbl...
Hi I am trying to display on a web page number of visitors on the site. I
am
doing this by increasing +1 in global.asax on Session_start and
subtracting -1 on Session_end. I am storing value in the
Application("numberOfVisitors"). It works fine but when I compare values

to
number of ASP Applications "Sessions Active" under Windows 2003

performance
chart gives me different values. I am not sure why there is a

difference, and also if there is some better way of doing it? Is it possible in code

to
count number of "Sessions Active" and display this instead of adding one

and
subtracting one?

Thanks,

Sinisa


Nov 19 '05 #3
Hi Sinisa,

I think what you found is a reasonable behavior since there're also other
things may cause the Session_End not fire in additional to using
out-of-process SessionState. For example:

1. When the user's session is never used(store any data), that session is
keeping a random session which dosn't have a fixed sessionid( it will
change in each new request (postback)). So such session won't fire
Session_End event.

2. When we close the browser at client, the serverside also have no idea of
the clientside's status, so the session_end may not fire either.

In addition, here is a certain FAQ provide many of such questions on
ASP.NET sessionState, you can have a look to see whether it helps to
clarify the the problem:

http://www.asp.net/Forums/ShowPost.a...=1&PostID=7504

HTH. Thanks,

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #4
Is it more accurate than to use pref counter Sessions Active? We usually
have around 100-200 people visiting web site, and I need some counter that
is easy to implement and it approximately accurate? Are there some issues or
problems with pref counter Sessions Active?

Thanks,

Sinisa

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:WD*************@TK2MSFTNGXA02.phx.gbl...
Hi Sinisa,

I think what you found is a reasonable behavior since there're also other
things may cause the Session_End not fire in additional to using
out-of-process SessionState. For example:

1. When the user's session is never used(store any data), that session is
keeping a random session which dosn't have a fixed sessionid( it will
change in each new request (postback)). So such session won't fire
Session_End event.

2. When we close the browser at client, the serverside also have no idea of the clientside's status, so the session_end may not fire either.

In addition, here is a certain FAQ provide many of such questions on
ASP.NET sessionState, you can have a look to see whether it helps to
clarify the the problem:

http://www.asp.net/Forums/ShowPost.a...=1&PostID=7504

HTH. Thanks,

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #5
Hi TheOne,

Thanks for your followup. I think the perf counter value is more accurate.
I'm not sure its detailed internal mechanism, but I'm sure it has its own
timeout mechnism no only rely on the Session_End. Also, I haven't found any
known issues or concerns on using performance counters on web page. Thanks,
Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #6

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

Similar topics

23
by: deko | last post by:
Can someone point me to a sample script that will log all visitors to my web site? I'm looking for a simple script that will capture IP address, Host Name, Browser, OS, and referring page - and...
5
by: toedipper | last post by:
Hello, I am developing a site using php and mysql and I would like to be able to let visitors know how many other visitors are currently browsing the site i.e. 'There are currently x amount of...
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. ...
5
by: Frederick J. Barnett | last post by:
I'm re-doing one of my web sites, and I'm considering finally making the jump to CSS. I've always resisted using it before out of worries that there are still a lot of non-CSS capable browsers out...
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...
32
by: Nu | last post by:
I want to protect myself from if someone with a fast connection hammers my site. It's not denial of service attacks, but offline downloaders (of course that don't show they're offline downloaders...
4
by: Chris | last post by:
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...
6
by: tenxian | last post by:
It is said as for code, developing a website that can stand 10,000 concurrent visitors is much different from developing a website that can stand 1,000 concurrent visitors, is it true?
1
by: dez5000 | last post by:
I'm trying to get a report by location that would list the number of visits to the location for the month but also count the number of unique visitors to that location. I have a table of data with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.