Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem with Session_End in Global.asax

Reply
Thread Tools

Problem with Session_End in Global.asax

 
 
=?Utf-8?B?QmVsYQ==?=
Guest
Posts: n/a
 
      04-13-2004
Hello

I was wondering if someone could help me out with a Session_End problem in my Global.asax. I've tried everything, and still no success
Here is the scenario: sessionstate is set to InProc. I have timeout set to 1 min
I have a variable in session_start that is incremented each new session, and it is then decremented in Session_End. I use this variable on a web form to show current users online. All of this works just fine, so I know that session_end event handler is firing
I also have the following in the Application_AuthenticateRequest handlerThis is an instance method that performs an update stored procedure in Sql Server 2000, and it also works fine
Activity myActivity = new Activity( )
myActivity.Method(User.Identity.Name.ToString( ), true)

Here's the prob: Session_end also contains this
Activity myActivity = new Activity( )
myActivity.Method(User.Identity.Name.ToString( ), false)

when the session timeout occurs after 1 min, this procedure does not work. What am I doing wrong? Please help. The decrementing of the variable works in session_end, why won't this
Thank you in advance for any help on this subject.
 
Reply With Quote
 
 
 
 
Cliff Harris
Guest
Posts: n/a
 
      04-13-2004
I created a quick test app to see if I could repro your problem, and I did.
I think I figured out why it is failing as well.
When I went debugging through the code and set a breakpoint in the
Session_End event and tried to access User.Identity, an exception was
thrown. You don't see this exception because it is apparently squished and
ignored by ASP.Net.

From what I can gather, in the Session_End event the login information has
already been lost and therefore User.Identidy fails. I am going to assume
that the counter that you decrement is before the code that accesses
User.Identity. That code will get executed which is why the counter is
working, but because User.Identity fails, your call to
myActivity.Method(...) fails.

HTH,
-Cliff

"Bela" <> wrote in message
news:52446A95-4259-4D22-8384-...
> Hello,
>
> I was wondering if someone could help me out with a Session_End problem in

my Global.asax. I've tried everything, and still no success!
> Here is the scenario: sessionstate is set to InProc. I have timeout set

to 1 min.
> I have a variable in session_start that is incremented each new session,

and it is then decremented in Session_End. I use this variable on a web
form to show current users online. All of this works just fine, so I know
that session_end event handler is firing.
> I also have the following in the Application_AuthenticateRequest

handlerThis is an instance method that performs an update stored procedure
in Sql Server 2000, and it also works fine)
> Activity myActivity = new Activity( );
> myActivity.Method(User.Identity.Name.ToString( ), true);
>
> Here's the prob: Session_end also contains this:
> Activity myActivity = new Activity( );
> myActivity.Method(User.Identity.Name.ToString( ), false);
>
> when the session timeout occurs after 1 min, this procedure does not work.

What am I doing wrong? Please help. The decrementing of the variable works
in session_end, why won't this?
> Thank you in advance for any help on this subject.



 
Reply With Quote
 
 
 
 
coollzh
Guest
Posts: n/a
 
      04-13-2004
i think you should debug you function
myActivity.Method(User.Identity.Name.ToString( ), false);

just writing some trace to check why the function do not work...

"Bela" <> дÈëÏûÏ¢
news:52446A95-4259-4D22-8384-...
> Hello,
>
> I was wondering if someone could help me out with a Session_End problem in

my Global.asax. I've tried everything, and still no success!
> Here is the scenario: sessionstate is set to InProc. I have timeout set

to 1 min.
> I have a variable in session_start that is incremented each new session,

and it is then decremented in Session_End. I use this variable on a web
form to show current users online. All of this works just fine, so I know
that session_end event handler is firing.
> I also have the following in the Application_AuthenticateRequest

handlerThis is an instance method that performs an update stored procedure
in Sql Server 2000, and it also works fine)
> Activity myActivity = new Activity( );
> myActivity.Method(User.Identity.Name.ToString( ), true);
>
> Here's the prob: Session_end also contains this:
> Activity myActivity = new Activity( );
> myActivity.Method(User.Identity.Name.ToString( ), false);
>
> when the session timeout occurs after 1 min, this procedure does not work.

What am I doing wrong? Please help. The decrementing of the variable works
in session_end, why won't this?
> Thank you in advance for any help on this subject.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Session_End problem Lars Netzel ASP .Net 5 04-27-2005 01:24 PM
Problem with global.asa & Session_End PiGei ASP General 5 02-05-2004 04:54 PM
Session_End never fires Kenn Ghannon ASP .Net 9 07-10-2003 02:49 PM
session_end and re-login Burak Kadirbeyoglu ASP .Net 1 07-10-2003 02:00 PM
Session_End Not Firing Chris Sibel ASP .Net 2 07-02-2003 08:04 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57