473,544 Members | 2,233 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sessions never end (again) - Please help

This is a repost (pasted below). Since my original post, I've double
checked the system clock and set all IIS Session Timeout values to 10
minutes. Still ...the problem occurs. I've also installed Deep Metrix Live
Stats 6.2 XPS just to make sure nothing really strange was going on was
going on. Still....the sessions only increment...or should I say my counter
in my asax file.... and never goes down.

If it matters, this machine is hosting 3 sites and it has a single IP
address. I've set IIS 5 to look at the host headers and redirect to the
"site" on itself. This is done every day and I can't possibly see how this
would effect the Sessions but you never know.

I'm totally stumped!! Thoughts?....
*************** **

I'm using ASP(.NET) trickery to show the number of "current users" on one of
my web sites (http://www.drpt.virginia.gov). I use this method on a few of
my sites but it seems that only this one (on this machine) gives me trouble.
The trouble seems that the sessions simply never end so the code in my Sub
Session_OnEnd is never fired. As I understand it, sessions will expire
after 20 minutes but default if there is no further activity from the
requestor. Yet, my counter never seems to decrement....on ly increment. My
code is below and I don't think it's a code (ASP) issue...this is a common
trick and this exact code works fine on other sites. I think it's an issue
with this one machine. Can anyone help or tell me what to check??

Thanks!!

My global.asax file:

'************** *************** *************** *******

Sub Application_OnS tart

Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
Application("Cu rrentSessions") = 0
Application("To talSessions") = 0

End Sub

'************** *************** *************** ******

Sub Application_OnE nd

Application("UR LSeed") = Nothing

End Sub

'************** *************** *************** ******

Sub Session_OnStart

'============== =============== ===============
'===== Updating Current Sessions =============== =====
'============== =============== ===============
Application.Loc k

Application("To talSessions") = CInt(Applicatio n("TotalSession s")) + 1
Application("Cu rrentSessions") = CInt(Applicatio n("CurrentSessi ons")) + 1

Application.Unl ock

End Sub

'************** *************** *************** ******

Sub Session_OnEnd

Application.Loc k

Application("Cu rrentSessions") = CInt(Applicatio n("CurrentSessi ons")) - 1

Application.Unl ock

'Killing user's session variables
Session.Abandon ()

End Sub
'************** *************** *************** *******


Nov 18 '05 #1
12 2260
I assume you are using InProc session state mode?

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:OJ******** ******@TK2MSFTN GP11.phx.gbl...
This is a repost (pasted below). Since my original post, I've double
checked the system clock and set all IIS Session Timeout values to 10
minutes. Still ...the problem occurs. I've also installed Deep Metrix Live Stats 6.2 XPS just to make sure nothing really strange was going on was
going on. Still....the sessions only increment...or should I say my counter in my asax file.... and never goes down.

If it matters, this machine is hosting 3 sites and it has a single IP
address. I've set IIS 5 to look at the host headers and redirect to the
"site" on itself. This is done every day and I can't possibly see how this would effect the Sessions but you never know.

I'm totally stumped!! Thoughts?....
*************** **

I'm using ASP(.NET) trickery to show the number of "current users" on one of my web sites (http://www.drpt.virginia.gov). I use this method on a few of my sites but it seems that only this one (on this machine) gives me trouble. The trouble seems that the sessions simply never end so the code in my Sub
Session_OnEnd is never fired. As I understand it, sessions will expire
after 20 minutes but default if there is no further activity from the
requestor. Yet, my counter never seems to decrement....on ly increment. My
code is below and I don't think it's a code (ASP) issue...this is a common
trick and this exact code works fine on other sites. I think it's an issue with this one machine. Can anyone help or tell me what to check??

Thanks!!

My global.asax file:

'************** *************** *************** *******

Sub Application_OnS tart

Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
Application("Cu rrentSessions") = 0
Application("To talSessions") = 0

End Sub

'************** *************** *************** ******

Sub Application_OnE nd

Application("UR LSeed") = Nothing

End Sub

'************** *************** *************** ******

Sub Session_OnStart

'============== =============== ===============
'===== Updating Current Sessions =============== =====
'============== =============== ===============
Application.Loc k

Application("To talSessions") = CInt(Applicatio n("TotalSession s")) + 1
Application("Cu rrentSessions") = CInt(Applicatio n("CurrentSessi ons")) + 1
Application.Unl ock

End Sub

'************** *************** *************** ******

Sub Session_OnEnd

Application.Loc k

Application("Cu rrentSessions") = CInt(Applicatio n("CurrentSessi ons")) - 1
Application.Unl ock

'Killing user's session variables
Session.Abandon ()

End Sub
'************** *************** *************** *******

Nov 18 '05 #2
What if you try Session_End instead ?

Also I would start bu putting there something else to see wether or not it's
excuted...

Patrice
--

"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> a écrit dans le message
de news:OJ******** ******@TK2MSFTN GP11.phx.gbl...
This is a repost (pasted below). Since my original post, I've double
checked the system clock and set all IIS Session Timeout values to 10
minutes. Still ...the problem occurs. I've also installed Deep Metrix Live Stats 6.2 XPS just to make sure nothing really strange was going on was
going on. Still....the sessions only increment...or should I say my counter in my asax file.... and never goes down.

If it matters, this machine is hosting 3 sites and it has a single IP
address. I've set IIS 5 to look at the host headers and redirect to the
"site" on itself. This is done every day and I can't possibly see how this would effect the Sessions but you never know.

I'm totally stumped!! Thoughts?....
*************** **

I'm using ASP(.NET) trickery to show the number of "current users" on one of my web sites (http://www.drpt.virginia.gov). I use this method on a few of my sites but it seems that only this one (on this machine) gives me trouble. The trouble seems that the sessions simply never end so the code in my Sub
Session_OnEnd is never fired. As I understand it, sessions will expire
after 20 minutes but default if there is no further activity from the
requestor. Yet, my counter never seems to decrement....on ly increment. My
code is below and I don't think it's a code (ASP) issue...this is a common
trick and this exact code works fine on other sites. I think it's an issue with this one machine. Can anyone help or tell me what to check??

Thanks!!

My global.asax file:

'************** *************** *************** *******

Sub Application_OnS tart

Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
Application("Cu rrentSessions") = 0
Application("To talSessions") = 0

End Sub

'************** *************** *************** ******

Sub Application_OnE nd

Application("UR LSeed") = Nothing

End Sub

'************** *************** *************** ******

Sub Session_OnStart

'============== =============== ===============
'===== Updating Current Sessions =============== =====
'============== =============== ===============
Application.Loc k

Application("To talSessions") = CInt(Applicatio n("TotalSession s")) + 1
Application("Cu rrentSessions") = CInt(Applicatio n("CurrentSessi ons")) + 1
Application.Unl ock

End Sub

'************** *************** *************** ******

Sub Session_OnEnd

Application.Loc k

Application("Cu rrentSessions") = CInt(Applicatio n("CurrentSessi ons")) - 1
Application.Unl ock

'Killing user's session variables
Session.Abandon ()

End Sub
'************** *************** *************** *******

Nov 18 '05 #3
Not sure. Can you clarify a little? Thanks
"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:eb******** *****@tk2msftng p13.phx.gbl...
I assume you are using InProc session state mode?

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:OJ******** ******@TK2MSFTN GP11.phx.gbl...
This is a repost (pasted below). Since my original post, I've double
checked the system clock and set all IIS Session Timeout values to 10
minutes. Still ...the problem occurs. I've also installed Deep Metrix Live
Stats 6.2 XPS just to make sure nothing really strange was going on was
going on. Still....the sessions only increment...or should I say my

counter
in my asax file.... and never goes down.

If it matters, this machine is hosting 3 sites and it has a single IP
address. I've set IIS 5 to look at the host headers and redirect to the
"site" on itself. This is done every day and I can't possibly see how

this
would effect the Sessions but you never know.

I'm totally stumped!! Thoughts?....
*************** **

I'm using ASP(.NET) trickery to show the number of "current users" on one of
my web sites (http://www.drpt.virginia.gov). I use this method on a few of
my sites but it seems that only this one (on this machine) gives me

trouble.
The trouble seems that the sessions simply never end so the code in my

Sub Session_OnEnd is never fired. As I understand it, sessions will expire
after 20 minutes but default if there is no further activity from the
requestor. Yet, my counter never seems to decrement....on ly increment. My code is below and I don't think it's a code (ASP) issue...this is a common trick and this exact code works fine on other sites. I think it's an

issue
with this one machine. Can anyone help or tell me what to check??

Thanks!!

My global.asax file:

'************** *************** *************** *******

Sub Application_OnS tart

Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
Application("Cu rrentSessions") = 0
Application("To talSessions") = 0

End Sub

'************** *************** *************** ******

Sub Application_OnE nd

Application("UR LSeed") = Nothing

End Sub

'************** *************** *************** ******

Sub Session_OnStart

'============== =============== ===============
'===== Updating Current Sessions =============== =====
'============== =============== ===============
Application.Loc k

Application("To talSessions") = CInt(Applicatio n("TotalSession s")) + 1
Application("Cu rrentSessions") = CInt(Applicatio n("CurrentSessi ons"))

+ 1

Application.Unl ock

End Sub

'************** *************** *************** ******

Sub Session_OnEnd

Application.Loc k

Application("Cu rrentSessions") =
CInt(Applicatio n("CurrentSessi ons")) - 1

Application.Unl ock

'Killing user's session variables
Session.Abandon ()

End Sub
'************** *************** *************** *******


Nov 18 '05 #4
In your web.config, you have the setting :-
<sessionState mode="InProc" cookieless=fals e etc......

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Not sure. Can you clarify a little? Thanks
"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:eb******** *****@tk2msftng p13.phx.gbl...
I assume you are using InProc session state mode?

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:OJ******** ******@TK2MSFTN GP11.phx.gbl...
This is a repost (pasted below). Since my original post, I've double
checked the system clock and set all IIS Session Timeout values to 10
minutes. Still ...the problem occurs. I've also installed Deep Metrix
Live
Stats 6.2 XPS just to make sure nothing really strange was going on
was going on. Still....the sessions only increment...or should I say my counter
in my asax file.... and never goes down.

If it matters, this machine is hosting 3 sites and it has a single IP
address. I've set IIS 5 to look at the host headers and redirect to the "site" on itself. This is done every day and I can't possibly see how

this
would effect the Sessions but you never know.

I'm totally stumped!! Thoughts?....
*************** **

I'm using ASP(.NET) trickery to show the number of "current users" on one
of
my web sites (http://www.drpt.virginia.gov). I use this method on a few of
my sites but it seems that only this one (on this machine) gives me

trouble.
The trouble seems that the sessions simply never end so the code in my

Sub Session_OnEnd is never fired. As I understand it, sessions will
expire after 20 minutes but default if there is no further activity from the
requestor. Yet, my counter never seems to decrement....on ly increment. My code is below and I don't think it's a code (ASP) issue...this is a common trick and this exact code works fine on other sites. I think it's an issue
with this one machine. Can anyone help or tell me what to check??

Thanks!!

My global.asax file:

'************** *************** *************** *******

Sub Application_OnS tart

Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
Application("Cu rrentSessions") = 0
Application("To talSessions") = 0

End Sub

'************** *************** *************** ******

Sub Application_OnE nd

Application("UR LSeed") = Nothing

End Sub

'************** *************** *************** ******

Sub Session_OnStart

'============== =============== ===============
'===== Updating Current Sessions =============== =====
'============== =============== ===============
Application.Loc k

Application("To talSessions") = CInt(Applicatio n("TotalSession s")) +

1 Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons")) +
1

Application.Unl ock

End Sub

'************** *************** *************** ******

Sub Session_OnEnd

Application.Loc k

Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons")) -
1

Application.Unl ock

'Killing user's session variables
Session.Abandon ()

End Sub
'************** *************** *************** *******



Nov 18 '05 #5
Thanks! I added that and did a little research on InProc. We'll see what
happens. I've also been using Session_OnEnd in my asax file instead of
Session_End as I showed in my code.

So what's the difference and did this OnEnd change just to "End" in .NET?
I've always used OnStart and OnEnd in my asa (classic) files. Yet all my
books and online resources just mentioned "End" but never explain that this
has changed. Did it infact change?

Thanks again!


"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
In your web.config, you have the setting :-
<sessionState mode="InProc" cookieless=fals e etc......

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Not sure. Can you clarify a little? Thanks
"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:eb******** *****@tk2msftng p13.phx.gbl...
I assume you are using InProc session state mode?

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:OJ******** ******@TK2MSFTN GP11.phx.gbl...
> This is a repost (pasted below). Since my original post, I've double > checked the system clock and set all IIS Session Timeout values to 10 > minutes. Still ...the problem occurs. I've also installed Deep Metrix Live
> Stats 6.2 XPS just to make sure nothing really strange was going on was > going on. Still....the sessions only increment...or should I say my
counter
> in my asax file.... and never goes down.
>
> If it matters, this machine is hosting 3 sites and it has a single IP > address. I've set IIS 5 to look at the host headers and redirect to the > "site" on itself. This is done every day and I can't possibly see how this
> would effect the Sessions but you never know.
>
> I'm totally stumped!! Thoughts?....
>
>
> *************** **
>
> I'm using ASP(.NET) trickery to show the number of "current users" on
one
of
> my web sites (http://www.drpt.virginia.gov). I use this method on a few of
> my sites but it seems that only this one (on this machine) gives me
trouble.
> The trouble seems that the sessions simply never end so the code in
my
Sub
> Session_OnEnd is never fired. As I understand it, sessions will
expire > after 20 minutes but default if there is no further activity from
the > requestor. Yet, my counter never seems to decrement....on ly

increment.
My
> code is below and I don't think it's a code (ASP) issue...this is a

common
> trick and this exact code works fine on other sites. I think it's an issue
> with this one machine. Can anyone help or tell me what to check??
>
> Thanks!!
>
> My global.asax file:
>
> '************** *************** *************** *******
>
> Sub Application_OnS tart
>
> Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
> Application("Cu rrentSessions") = 0
> Application("To talSessions") = 0
>
> End Sub
>
> '************** *************** *************** ******
>
> Sub Application_OnE nd
>
> Application("UR LSeed") = Nothing
>
> End Sub
>
> '************** *************** *************** ******
>
> Sub Session_OnStart
>
> '============== =============== ===============
> '===== Updating Current Sessions =============== =====
> '============== =============== ===============
> Application.Loc k
>
> Application("To talSessions") = CInt(Applicatio n("TotalSession s"))

+ 1 > Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons"))
+
1
>
> Application.Unl ock
>
> End Sub
>
> '************** *************** *************** ******
>
> Sub Session_OnEnd
>
> Application.Loc k
>
> Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons")) -
1
>
> Application.Unl ock
>
> 'Killing user's session variables
> Session.Abandon ()
>
> End Sub
> '************** *************** *************** *******
>
>
>
>



Nov 18 '05 #6
Your web.config will contain a line like :-

<sessionState mode="InProc" .....>

or some other similar setting.(StateS erver etc...). If you can provide the
contents of this entry, that may help.

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Not sure. Can you clarify a little? Thanks
"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:eb******** *****@tk2msftng p13.phx.gbl...
I assume you are using InProc session state mode?

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:OJ******** ******@TK2MSFTN GP11.phx.gbl...
This is a repost (pasted below). Since my original post, I've double
checked the system clock and set all IIS Session Timeout values to 10
minutes. Still ...the problem occurs. I've also installed Deep Metrix
Live
Stats 6.2 XPS just to make sure nothing really strange was going on
was going on. Still....the sessions only increment...or should I say my counter
in my asax file.... and never goes down.

If it matters, this machine is hosting 3 sites and it has a single IP
address. I've set IIS 5 to look at the host headers and redirect to the "site" on itself. This is done every day and I can't possibly see how

this
would effect the Sessions but you never know.

I'm totally stumped!! Thoughts?....
*************** **

I'm using ASP(.NET) trickery to show the number of "current users" on one
of
my web sites (http://www.drpt.virginia.gov). I use this method on a few of
my sites but it seems that only this one (on this machine) gives me

trouble.
The trouble seems that the sessions simply never end so the code in my

Sub Session_OnEnd is never fired. As I understand it, sessions will
expire after 20 minutes but default if there is no further activity from the
requestor. Yet, my counter never seems to decrement....on ly increment. My code is below and I don't think it's a code (ASP) issue...this is a common trick and this exact code works fine on other sites. I think it's an issue
with this one machine. Can anyone help or tell me what to check??

Thanks!!

My global.asax file:

'************** *************** *************** *******

Sub Application_OnS tart

Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
Application("Cu rrentSessions") = 0
Application("To talSessions") = 0

End Sub

'************** *************** *************** ******

Sub Application_OnE nd

Application("UR LSeed") = Nothing

End Sub

'************** *************** *************** ******

Sub Session_OnStart

'============== =============== ===============
'===== Updating Current Sessions =============== =====
'============== =============== ===============
Application.Loc k

Application("To talSessions") = CInt(Applicatio n("TotalSession s")) +

1 Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons")) +
1

Application.Unl ock

End Sub

'************** *************** *************** ******

Sub Session_OnEnd

Application.Loc k

Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons")) -
1

Application.Unl ock

'Killing user's session variables
Session.Abandon ()

End Sub
'************** *************** *************** *******



Nov 18 '05 #7
Thanks! My web.config file is as follows:

<configuratio n>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
<sessionState mode="InProc" />
</system.web>
</configuration>
I'm STILL having this problem though. I came back this a.m. and checked it
and the site had "2000+ current users" which of course is false. It just
counted ALL users over the weekend and never released the sessions. I also
believe there is some confusion on my part on Session_OnEnd and Session_End
(see reply above).

"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Your web.config will contain a line like :-

<sessionState mode="InProc" .....>

or some other similar setting.(StateS erver etc...). If you can provide the
contents of this entry, that may help.

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Not sure. Can you clarify a little? Thanks
"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:eb******** *****@tk2msftng p13.phx.gbl...
I assume you are using InProc session state mode?

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:OJ******** ******@TK2MSFTN GP11.phx.gbl...
> This is a repost (pasted below). Since my original post, I've double > checked the system clock and set all IIS Session Timeout values to 10 > minutes. Still ...the problem occurs. I've also installed Deep Metrix Live
> Stats 6.2 XPS just to make sure nothing really strange was going on was > going on. Still....the sessions only increment...or should I say my
counter
> in my asax file.... and never goes down.
>
> If it matters, this machine is hosting 3 sites and it has a single IP > address. I've set IIS 5 to look at the host headers and redirect to the > "site" on itself. This is done every day and I can't possibly see how this
> would effect the Sessions but you never know.
>
> I'm totally stumped!! Thoughts?....
>
>
> *************** **
>
> I'm using ASP(.NET) trickery to show the number of "current users" on
one
of
> my web sites (http://www.drpt.virginia.gov). I use this method on a few of
> my sites but it seems that only this one (on this machine) gives me
trouble.
> The trouble seems that the sessions simply never end so the code in
my
Sub
> Session_OnEnd is never fired. As I understand it, sessions will
expire > after 20 minutes but default if there is no further activity from
the > requestor. Yet, my counter never seems to decrement....on ly

increment.
My
> code is below and I don't think it's a code (ASP) issue...this is a

common
> trick and this exact code works fine on other sites. I think it's an issue
> with this one machine. Can anyone help or tell me what to check??
>
> Thanks!!
>
> My global.asax file:
>
> '************** *************** *************** *******
>
> Sub Application_OnS tart
>
> Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
> Application("Cu rrentSessions") = 0
> Application("To talSessions") = 0
>
> End Sub
>
> '************** *************** *************** ******
>
> Sub Application_OnE nd
>
> Application("UR LSeed") = Nothing
>
> End Sub
>
> '************** *************** *************** ******
>
> Sub Session_OnStart
>
> '============== =============== ===============
> '===== Updating Current Sessions =============== =====
> '============== =============== ===============
> Application.Loc k
>
> Application("To talSessions") = CInt(Applicatio n("TotalSession s"))

+ 1 > Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons"))
+
1
>
> Application.Unl ock
>
> End Sub
>
> '************** *************** *************** ******
>
> Sub Session_OnEnd
>
> Application.Loc k
>
> Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons")) -
1
>
> Application.Unl ock
>
> 'Killing user's session variables
> Session.Abandon ()
>
> End Sub
> '************** *************** *************** *******
>
>
>
>



Nov 18 '05 #8
....and finally, I added a AdHoc counter to see if indeed sessions are ever
ending. This will simply (in theory) increment a value in a counter table...
global.asax file:

<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<%@ Import Namespace="Syst em.Web.Mail" %>

<script language="vb" runat="server">

'************** *************** *************** *************** *************** *
*************** *************** *************** **
Sub Application_OnS tart

Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
Application("Cu rrentSessions") = 0
Application("To talSessions") = 0

End Sub
'************** *************** *************** *************** *************** *
*************** *************** *************** **

'************** *************** *************** *************** *************** *
*************** *************** *************** **
Sub Application_OnE nd

Application("UR LSeed") = Nothing

End Sub
'************** *************** *************** *************** *************** *
*************** *************** *************** **
'************** *************** *************** *************** *************** *
*************** *************** *************** **
Sub Session_OnStart

'Updating Current Sessions
Application.Loc k

Application("To talSessions") = CInt(Applicatio n("TotalSession s")) + 1
Application("Cu rrentSessions") = CInt(Applicatio n("CurrentSessi ons")) + 1

Application.Unl ock

End Sub
'************** *************** *************** *************** *************** *
*************** *************** *************** **

'************** *************** *************** *************** *************** *
*************** *************** *************** **
Sub Session_End

Application.Loc k

Application("Cu rrentSessions") = CInt(Applicatio n("CurrentSessi ons")) - 1

Application.Unl ock

'Killing user's session variables
Session.Abandon ()

'Call Test Sub Routine
UpdateSessionEn dTable()

End Sub
'************** *************** *************** *************** *************** *
*************** *************** *************** **
'************** *************** *************** *************** *************** *
*************** *************** *************** **
Sub UpdateSessionEn dTable()

Dim conSqlServer As SqlConnection
Dim strUpdateSQL As String
Dim cmdUpdate As SqlCommand
Dim strConnectStrin g As String

strConnectStrin g = "server=...blah ...."
strUpdateSQL = "UPDATE SessionEndCount er SET Counter = " &
"[SessionEndCount er].[Counter] + 1 "

conSqlServer = New SqlConnection(s trConnectString )
cmdUpdate = New SqlCommand(strU pdateSQL, conSqlServer)
conSQLServer.Op en()
cmdUpdate.Execu teNonQuery()
conSQLServer.Cl ose()

End Sub
'************** *************** *************** *************** *************** *
*************** *************** *************** **

</script>

"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Your web.config will contain a line like :-

<sessionState mode="InProc" .....>

or some other similar setting.(StateS erver etc...). If you can provide the
contents of this entry, that may help.

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Not sure. Can you clarify a little? Thanks
"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:eb******** *****@tk2msftng p13.phx.gbl...
I assume you are using InProc session state mode?

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:OJ******** ******@TK2MSFTN GP11.phx.gbl...
> This is a repost (pasted below). Since my original post, I've double > checked the system clock and set all IIS Session Timeout values to 10 > minutes. Still ...the problem occurs. I've also installed Deep Metrix Live
> Stats 6.2 XPS just to make sure nothing really strange was going on was > going on. Still....the sessions only increment...or should I say my
counter
> in my asax file.... and never goes down.
>
> If it matters, this machine is hosting 3 sites and it has a single IP > address. I've set IIS 5 to look at the host headers and redirect to the > "site" on itself. This is done every day and I can't possibly see how this
> would effect the Sessions but you never know.
>
> I'm totally stumped!! Thoughts?....
>
>
> *************** **
>
> I'm using ASP(.NET) trickery to show the number of "current users" on
one
of
> my web sites (http://www.drpt.virginia.gov). I use this method on a few of
> my sites but it seems that only this one (on this machine) gives me
trouble.
> The trouble seems that the sessions simply never end so the code in
my
Sub
> Session_OnEnd is never fired. As I understand it, sessions will
expire > after 20 minutes but default if there is no further activity from
the > requestor. Yet, my counter never seems to decrement....on ly

increment.
My
> code is below and I don't think it's a code (ASP) issue...this is a

common
> trick and this exact code works fine on other sites. I think it's an issue
> with this one machine. Can anyone help or tell me what to check??
>
> Thanks!!
>
> My global.asax file:
>
> '************** *************** *************** *******
>
> Sub Application_OnS tart
>
> Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
> Application("Cu rrentSessions") = 0
> Application("To talSessions") = 0
>
> End Sub
>
> '************** *************** *************** ******
>
> Sub Application_OnE nd
>
> Application("UR LSeed") = Nothing
>
> End Sub
>
> '************** *************** *************** ******
>
> Sub Session_OnStart
>
> '============== =============== ===============
> '===== Updating Current Sessions =============== =====
> '============== =============== ===============
> Application.Loc k
>
> Application("To talSessions") = CInt(Applicatio n("TotalSession s"))

+ 1 > Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons"))
+
1
>
> Application.Unl ock
>
> End Sub
>
> '************** *************** *************** ******
>
> Sub Session_OnEnd
>
> Application.Loc k
>
> Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons")) -
1
>
> Application.Unl ock
>
> 'Killing user's session variables
> Session.Abandon ()
>
> End Sub
> '************** *************** *************** *******
>
>
>
>



Nov 18 '05 #9
Which one are you using (Session_OnEnd, Session_End ?) AFAIK under ASP.NET
you should use Session_End.
For now you could keep both and use an application variable to count how
often it is fired (hopefully you'll find Session_End always fires while
Session_OnEnd is never called).

In some cases, the On<EventName> *method* is what the class does for you on
this event (in particular it raises the <EventName> event) and the
<EventName> *event* is to declare what you would like to do. That's probably
why they renamed the event compared with ASP classic.

--

"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> a écrit dans le message
de news:%2******** *******@tk2msft ngp13.phx.gbl.. .
Thanks! My web.config file is as follows:

<configuratio n>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
<sessionState mode="InProc" />
</system.web>
</configuration>
I'm STILL having this problem though. I came back this a.m. and checked it and the site had "2000+ current users" which of course is false. It just
counted ALL users over the weekend and never released the sessions. I also believe there is some confusion on my part on Session_OnEnd and Session_End (see reply above).

"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Your web.config will contain a line like :-

<sessionState mode="InProc" .....>

or some other similar setting.(StateS erver etc...). If you can provide the
contents of this entry, that may help.

--
- Paul Glavich
Microsoft MVP - ASP.NET
"D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Not sure. Can you clarify a little? Thanks
"Paul Glavich [MVP - ASP.NET]" <gl**@aspallian ce.com-NOSPAM> wrote in
message news:eb******** *****@tk2msftng p13.phx.gbl...
> I assume you are using InProc session state mode?
>
> --
> - Paul Glavich
> Microsoft MVP - ASP.NET
>
>
> "D. Shane Fowlkes" <sh********** @h-o-t-m-a-i-l.com> wrote in message
> news:OJ******** ******@TK2MSFTN GP11.phx.gbl...
> > This is a repost (pasted below). Since my original post, I've double > > checked the system clock and set all IIS Session Timeout values to 10 > > minutes. Still ...the problem occurs. I've also installed Deep Metrix
> Live
> > Stats 6.2 XPS just to make sure nothing really strange was going on was
> > going on. Still....the sessions only increment...or should I say
my > counter
> > in my asax file.... and never goes down.
> >
> > If it matters, this machine is hosting 3 sites and it has a single IP > > address. I've set IIS 5 to look at the host headers and redirect to the
> > "site" on itself. This is done every day and I can't possibly see how > this
> > would effect the Sessions but you never know.
> >
> > I'm totally stumped!! Thoughts?....
> >
> >
> > *************** **
> >
> > I'm using ASP(.NET) trickery to show the number of "current users" on one
> of
> > my web sites (http://www.drpt.virginia.gov). I use this method on
a
few
> of
> > my sites but it seems that only this one (on this machine) gives

me > trouble.
> > The trouble seems that the sessions simply never end so the code in my Sub
> > Session_OnEnd is never fired. As I understand it, sessions will expire
> > after 20 minutes but default if there is no further activity from the > > requestor. Yet, my counter never seems to decrement....on ly

increment.
My
> > code is below and I don't think it's a code (ASP) issue...this is
a common
> > trick and this exact code works fine on other sites. I think it's

an > issue
> > with this one machine. Can anyone help or tell me what to check??
> >
> > Thanks!!
> >
> > My global.asax file:
> >
> > '************** *************** *************** *******
> >
> > Sub Application_OnS tart
> >
> > Application("UR LSeed") = "http://www.drpt.virgin ia.gov/"
> > Application("Cu rrentSessions") = 0
> > Application("To talSessions") = 0
> >
> > End Sub
> >
> > '************** *************** *************** ******
> >
> > Sub Application_OnE nd
> >
> > Application("UR LSeed") = Nothing
> >
> > End Sub
> >
> > '************** *************** *************** ******
> >
> > Sub Session_OnStart
> >
> > '============== =============== ===============
> > '===== Updating Current Sessions =============== =====
> > '============== =============== ===============
> > Application.Loc k
> >
> > Application("To talSessions") =

CInt(Applicatio n("TotalSession s")) +
1
> > Application("Cu rrentSessions") =

CInt(Applicatio n("CurrentSessi ons"))
+
> 1
> >
> > Application.Unl ock
> >
> > End Sub
> >
> > '************** *************** *************** ******
> >
> > Sub Session_OnEnd
> >
> > Application.Loc k
> >
> > Application("Cu rrentSessions") =
CInt(Applicatio n("CurrentSessi ons")) -
> 1
> >
> > Application.Unl ock
> >
> > 'Killing user's session variables
> > Session.Abandon ()
> >
> > End Sub
> > '************** *************** *************** *******
> >
> >
> >
> >
>
>



Nov 18 '05 #10

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

Similar topics

1
4796
by: Matrix | last post by:
I just got one virtual directory setup and try to run my web application from there. I am getting following error Microsoft VBScript runtime error '800a01a8' Object required: 'Session' I even try to create test.asp and put it in wwwroot folder only code I had was <% Response.write Session.SessionID %>
4
2945
by: JC | last post by:
Hello- I have a form which has a listbox, a textbox and a submit button. The user types a phone number into the textbox, clicks button, text gets added to the listbox. After this process I need the focus to be back in the textbox. Sounds easy hu? Here's my code- Private Sub cmdAddLine_Click(ByVal sender As System.Object, ByVal e As...
1
1700
by: A Hirsi | last post by:
I have created a vb .net program as a service that is using a simple ftpclient to connect to a remote server and check the status of a file for subsequent downloading if there have been changes to it. I have been having many problems and need your help. 1. When I use a thread to start the service it only runs once and quits. I do not see...
3
4020
by: promiscuoustx | last post by:
I am trying to get my program to compile, but it will not complete. At line 79 it states, cannot convert 'float()()' to 'float' in assignment. Here is my code. #include <iostream> #include <iomanip> #include <cmath> #include <cctype> #include <stdlib.h> #include <sstream> using namespace std;
22
3225
by: Amali | last post by:
I'm newdie in c programming. this is my first project in programming. I have to write a program for a airline reservation. this is what i have done yet. but when it runs it shows the number of seats as 0 and the flight no. is also repeating. If any can tell why is this please help me. #include<stdio.h> #include<ctype.h> #include<conio.h>
2
1733
by: Orgil | last post by:
I'm using ASP 3.0 however there is ASP.NET, because I'm working an old site that is built in ASP 3.0. I hope you for getting any help for my problem from you. So, my site's sessions are empty before its timeout. I have searched and checked for long time around this problem, but I can't fix the problem yet. The session timeout is 20...
6
16758
by: S_K | last post by:
Hi all! I'm writing an ASP.NET web application that uses an Oracle database. I OPEN the Oracle connection by using the following code: if (this.ConnectionString != "") { this.Connection = new OracleConnection(this.ConnectionString); this.Connection.Open();
1
1175
by: Harshpandya | last post by:
Here is my code - I want Function test to execute only after 5 seconds. function test(){ alert("After 5 sec"); } function f2(){ setTimeout(test,500); }
2
3516
by: violeta123 | last post by:
I am stuck! Please help It might be difficult to explain the problem via email, but I will try. I have a Win 2003 Enterprise server running with the only purpose of a membership web site that uses SQL server 2000 database. I had the site for over 5 years, but the problem started about 6 months ago. At random times (at least I have not...
0
7374
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7632
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7783
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7392
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...
0
5931
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...
1
5309
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4930
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...
0
3430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
996
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.