Re: Problem with Session_End in Global.asax

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Cliff Harris (hersh_at_myrealbox.com)
Date: 04/13/04


Date: Tue, 13 Apr 2004 10:43:22 -0400

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" <anonymous@discussions.microsoft.com> wrote in message
news:52446A95-4259-4D22-8384-602C7AB76565@microsoft.com...
> 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
handler:(This 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.



Relevant Pages

  • Okay, this makes four!
    ... CreateProcessAsUser from service fails with 233 ... Winlogon.exe reads the pipe then ... into some process in the new session and have it create the process ...
    (microsoft.public.platformsdk.security)
  • Re: Multiple X Sessions on OSR 6
    ... | Bob Stockler wrote: ... and command line startx fails with me in various ways. ... | session, X will start and give me the grey stippled background but no ...
    (comp.unix.sco.misc)
  • Re: Multiple X Sessions on OSR 6
    ... and command line startx fails with me in various ways. ... session, X will start and give me the grey stippled background but no ... The second problem I see is, upon issuing the startx command, it ...
    (comp.unix.sco.misc)
  • CreateProcessAsUser from service fails with 233 (FUS, Windows XP)
    ... screen) it fails with error 233. ... Logon as console user (session 0) ... OpenProcessToken("Winlogon.exe on active session") + ... DuplicateTokenEx + SetTokenInformation. ...
    (microsoft.public.platformsdk.security)
  • Re: How to check the number of client currently logged in ?
    ... I don't know how to do it using JSP. ... will allow you to track every session binding or unbinding events. ... - When the user logs in, you remember the session id and increments the ... you decrement the counter ...
    (comp.lang.java.programmer)