Session_End, how to know if it was called?

G

george d lake

Hi,
I have a app that for now all it does is Sets an Application variable =0
on Application Start and then on Session Start it adds 1 to that current
value.
What does not work is the Session_End. There I do Application Var =
Application Var - 1
If I let the session time out (2mins) and refresh a second session
(different PC) it does not show the the correct value.
If I refresh the orginal one, then it +1

What am i dooing wrong?

Where is the code:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

Application("MISUsers") = 0

Application("NatUsers") = 0

Application("GlobalUsers") = 0

End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)

' Fires when the session is started

If User.IsInRole("VYP\Global MIS") Then

Application("MISUsers") = Application("MISUsers") + 1

ElseIf User.IsInRole("VYP\Global Marketing") Then

Application("NatUsers") = Application("NatUsers") + 1

ElseIf User.IsInRole("VYP\Domain Users") Then

Application("GlobalUsers") = Application("GlobalUsers") + 1

End If

End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)

' Fires when the session ends

If User.IsInRole("VYP\Global MIS") Then

Application("MISUsers") = Application("MISUsers") - 1

ElseIf User.IsInRole("VYP\Global Marketing") Then

Application("NatUsers") = Application("NatUsers") - 1

ElseIf User.IsInRole("VYP\Domain Users") Then

Application("GlobalUsers") = Application("GlobalUsers") - 1

End If

End Sub
 
G

george d lake

Of course it will not work! IDIOT! (me)
If the session expires, then there is no user info, there for, IT ERRORS
OUT!


Some days........
went to bed late last night changing the breaks on my wife's car.....
Note to myself : Do not mix intensive manual labor with creative thinking
within a 24 period with out a good nights sleep.
 
G

george d lake

Any ideas?

george d lake said:
Of course it will not work! IDIOT! (me)
If the session expires, then there is no user info, there for, IT ERRORS
OUT!


Some days........
went to bed late last night changing the breaks on my wife's car.....
Note to myself : Do not mix intensive manual labor with creative thinking
within a 24 period with out a good nights sleep.


variable
 
K

Kevin Spencer

Store a variable in the Session that identifies what group the user beongs
to. It will be available in the Session_OnEnd.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top