473,320 Members | 2,122 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.

Get the number of sessions going on now.

Hiya!
How would i get this number? thanks!
Jul 19 '05 #1
19 7848
www.perfhound.com

"Jeff Clark" <JeffC@NO_SPAMreturnventures.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Hiya!
How would i get this number? thanks!

Jul 19 '05 #2
Sub Session_OnStart()
Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
End Sub

Sub Session_OnEnd()
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub

In your global.asa.

Ray at work
"Jeff Clark" <JeffC@NO_SPAMreturnventures.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Hiya!
How would i get this number? thanks!

Jul 19 '05 #3
i love you Ray.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:Oz**************@TK2MSFTNGP11.phx.gbl...
Sub Session_OnStart()
Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
End Sub

Sub Session_OnEnd()
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub

In your global.asa.

Ray at work
"Jeff Clark" <JeffC@NO_SPAMreturnventures.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Hiya!
How would i get this number? thanks!


Jul 19 '05 #4
I love you too Jeff. :]

Ray at work

"Jeff Clark" <JeffC@NO_SPAMreturnventures.com> wrote in message
news:uL**************@TK2MSFTNGP09.phx.gbl...
i love you Ray.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:Oz**************@TK2MSFTNGP11.phx.gbl...
Sub Session_OnStart()
Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
End Sub

Sub Session_OnEnd()
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub

In your global.asa.

Ray at work
"Jeff Clark" <JeffC@NO_SPAMreturnventures.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Hiya!
How would i get this number? thanks!



Jul 19 '05 #5
Careful though, the session_onEnd will not always fire when you expect, if
at all.
http://www.aspfaq.com/2078
"Jeff Clark" <JeffC@NO_SPAMreturnventures.com> wrote in message
news:uL**************@TK2MSFTNGP09.phx.gbl...
i love you Ray.

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:Oz**************@TK2MSFTNGP11.phx.gbl...
Sub Session_OnStart()
Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
End Sub

Sub Session_OnEnd()
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub

In your global.asa.

Ray at work
"Jeff Clark" <JeffC@NO_SPAMreturnventures.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Hiya!
How would i get this number? thanks!



Jul 19 '05 #6
> I love you too Jeff. :]

Stop guys.. I'm getting teary eyed.
Jul 19 '05 #7
Ray, take my clothes out of the dryer when you get home please

"Randy Rahbar" <rvrahbarAThotmail.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
I love you too Jeff. :]


Stop guys.. I'm getting teary eyed.

Jul 19 '05 #8
Evertjan. wrote on 13 nov 2003 in
microsoft.public.inetserver.asp.general:
Ray at <%=sLocation%> wrote on 13 nov 2003 in
microsoft.public.inetserver.asp.general:
Sub Session_OnStart()
Application.Lock
Application("SessionCount") = Application("SessionCount") + 1
Application.Unlock
End Sub

Sub Session_OnEnd()
Application.Lock
Application("SessionCount") = Application("SessionCount") - 1
Application.Unlock
End Sub

In your global.asa.


You will need this too, I think:

Sub Application_OnStart
Application("Active") = 0
End Sub

I mean:

Sub Application_OnStart
Application("SessionCount") = 0
End Sub


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #9
Oh, did you leave them in there again? You know that I hate it when you do
that! Now I'm going to have to iron them all again. >:|

Ray at work

"Jeff Clark" <JeffC@NO_SPAMreturnventures.com> wrote in message
news:uY*************@TK2MSFTNGP11.phx.gbl...
Ray, take my clothes out of the dryer when you get home please

"Randy Rahbar" <rvrahbarAThotmail.com> wrote in message
news:OC**************@TK2MSFTNGP09.phx.gbl...
I love you too Jeff. :]


Stop guys.. I'm getting teary eyed.


Jul 19 '05 #10
Also see the WMI approach.
http://www.aspfaq.com/2491


"Jeff Clark" <JeffC@NO_SPAMreturnventures.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
Hiya!
How would i get this number? thanks!

Jul 19 '05 #11
> Careful though, the session_onEnd will not always fire when you expect, if
at all.
http://www.aspfaq.com/2078


But it does always fire though (in my experience)...I have used Rays technique
for over 3 years and at the end of the day, the counter is always zero.

Brian

Jul 19 '05 #12
> But it does always fire though (in my experience)...I have used Rays
technique
for over 3 years and at the end of the day, the counter is always zero.


I've seen cases where it never fired. And remember that you're not always
checking the counts at the end of the day. :-)
Jul 19 '05 #13
Do you know in what situations it wouldn't fire? I mean, if you go and kill
inetinfo.exe or something, it fire then, but as soon as you did that, you'd
have zero sessions anyway.

Ray at work

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
But it does always fire though (in my experience)...I have used Rays

technique
for over 3 years and at the end of the day, the counter is always zero.


I've seen cases where it never fired. And remember that you're not always
checking the counts at the end of the day. :-)

Jul 19 '05 #14
That would be, "...it WON'T fire..."

Ray at work

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
if you go and kill inetinfo.exe or something, it fire then,

Jul 19 '05 #15
> Do you know in what situations it wouldn't fire? I mean, if you go and
kill
inetinfo.exe or something, it fire then, but as soon as you did that, you'd have zero sessions anyway.


I don't know the exact circumstance, but I had a site with a session timeout
of 20 minutes. One time the provider went down, so you couldn't ping the
box from outside (but I was inside, so could see the database, etc). I had
code in session_onEnd that cleaned out sessions from the database, and I had
about 30 active sessions at the time the site went down (easily queried
right after it happened; I was thinking, "oh crap, how many users did that
affect?"). I did a query 10 minutes later, and there were still 12 active
sessions (so 18 of them must have hit session_onEnd). 10 minutes later
(when all of the session_onEnd() calls should have completed), there were
still 5. An hour later, there were still 5. IIS was still running, nothing
had been restarted, etc.

This actually happened the day before I first wrote the "what is wrong with
session_onEnd()?" article. And I had no idea how I would be able to figure
out what was "special" about those 5 sessions; still don't know how I would
differentiate them if it were to happen today. Also, not sure if this is
still possible in the IIS 6.0 world; I think that was IIS 5.0 where I
experienced it.

Watch the new article about tracking sessions (2491) for the SQL Server
methodology mentioned in 2078.
Jul 19 '05 #16

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Do you know in what situations it wouldn't fire? I mean, if you go and kill
inetinfo.exe or something, it fire then, but as soon as you did that,

you'd
have zero sessions anyway.


I don't know the exact circumstance, but I had a site with a session

timeout of 20 minutes. One time the provider went down, so you couldn't ping the
box from outside (but I was inside, so could see the database, etc). I had code in session_onEnd that cleaned out sessions from the database, and I had about 30 active sessions at the time the site went down (easily queried
right after it happened; I was thinking, "oh crap, how many users did that
affect?"). I did a query 10 minutes later, and there were still 12 active
sessions (so 18 of them must have hit session_onEnd). 10 minutes later
(when all of the session_onEnd() calls should have completed), there were
still 5. An hour later, there were still 5. IIS was still running, nothing had been restarted, etc.


Interesting. Perhaps you should get a better server. :P So, in Jeff's
particular circumstance, it wouldn't matter, since the application variables
would be gone anyway, but it certainly does matter if the session_onend
needs to really do something the way yours was.

Ray at work
Jul 19 '05 #17
> Interesting. Perhaps you should get a better server. :P

Oh yeah, that was the problem!
So, in Jeff's
particular circumstance, it wouldn't matter, since the application variables would be gone anyway


I don't follow... can you elaborate? The application variables were not
gone in my scenario... the server was still running, but session_onEnd did
not fire for 5 of the 30 sessions. So, application("SessionCount") =
application("SessionCount") - 1 left application("SessionCount") 5 too high.
And this was NOT corrected when the server came back online, because the
only symptom of that was that users could hit the server again (the server
itself wasn't down; the provider's pipe was down).

Anyway, I updated http://www.aspfaq.com/2491 with a slightly more reliable
method using SQL Server (that still, admittedly, can leave sessions to be
counted as "active" until the timeout, when they really aren't truly
active... but it will never let a failed session_onEnd permanently spoil the
count).
Jul 19 '05 #18

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:Oz*************@TK2MSFTNGP11.phx.gbl...

I don't follow... can you elaborate? The application variables were not
gone in my scenario... the server was still running, but session_onEnd did
not fire for 5 of the 30 sessions. So, application("SessionCount") =
application("SessionCount") - 1 left application("SessionCount") 5 too high. And this was NOT corrected when the server came back online, because the
only symptom of that was that users could hit the server again (the server
itself wasn't down; the provider's pipe was down).
Yeah, never mind. I was reading it that the server went down. So, I guess
what I was saying is if you're using Session_OnEnd to update application
variable and the ~server~ goes down, it doesn't matter about Session_OnEnd
not updating your app variables, since they'll be gone anyway. But if
you're relying on Session_OnEnd to make changes outside of IIS, like update
a database, delete a file, etc., then yeah, it certainly would matter.

Anyway, I updated http://www.aspfaq.com/2491 with a slightly more reliable
method using SQL Server (that still, admittedly, can leave sessions to be
counted as "active" until the timeout, when they really aren't truly
active... but it will never let a failed session_onEnd permanently spoil

the

Nice. That WMI method is hardcore. Good job.

Ray at work
Jul 19 '05 #19
> Nice. That WMI method is hardcore. Good job.

Thanks. I guess you can start to imagine the amount of work that went into
PerfHound, and what a ridiculous bargain it is. :-)

It's too bad that WMI requires an Administrator account to be useful from
ASP. Though, I suppose it would be trivial to have local VBS scripts update
a database every so often (more often for volatile information like CPU
usage, less often for static information like # of CPUs).

Hey, that gives me an idea...
Jul 19 '05 #20

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

Similar topics

13
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location...
2
by: Lenn | last post by:
Hello, This requirement might seem strange to someone out there, but here it's We need to make sure only certain number of users can be logged in the site at the same time. Is there any way to...
4
by: Ollie | last post by:
Is there anyway to montior the number of user sessions from an asp.net app\page? The reason I ask is because I would like to throttle the number of concurrent sessions to a website, i.e. limit...
5
by: TheOne | last post by:
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...
15
by: dee | last post by:
Hi, What is the maximum number of minutes for Session timeout that I can specify in web.config? Thanks. Dee
2
by: tbone | last post by:
In trying to improve the throughput of a classic ASP app I wrote last year, I added monitoring to the application and session start and end methods. For one, I'm counting the total number of...
13
Frinavale
by: Frinavale | last post by:
One of the most fundamental topics in web design is understanding how to pass information collected on one web page to another web page. There are many different ways you could do this: Cookies,...
3
Atli
by: Atli | last post by:
Introduction: Sessions are one of the simplest and more powerful tools in a web developers arsenal. This tool is invaluable in dynamic web page development and it is one of those things every...
2
by: mktselvan | last post by:
Hi, Existing running oracle application 11i (11.5.8) Database version is 8.1.7.4 There is any command / way to know the number of concurrent users for this application. ...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
0
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.