re:
!> I *can* get objects back out of the Session
!> within the Global.asax Session_End() event.
Indeed, you can. The Session doesn't *end* until the event has finished executing.
The limitation I noted is for the *built-in* objects, i.e.,
Request, Response, Server, Application, and Session.
Out of those, the only ones available from within the
Session_End event handler are Server and Application.
While you could save an existing session variable to a log, by using
Server.MapPath, for example, you can't set a new session variable.
You can't response.write nor use context.current, either.
There's a lot you *can* do, however.
You need to remember, though, that Session_End may not fire under some circumstances,
so its use may not be as reliable as doing cleanup and logging when it *does* fire.
Juan T. Llibre, asp.net MVP
asp.net faq :
http://asp.net.do/faq/
foros de asp.net, en espańol :
http://asp.net.do/foros/
======================================
"Alex Maghen" <> wrote in message
news:5A111C39-8A67-4CF2-94D1-...
> Well, I guess what I don't get about that is that, in fact, it is ASP that is
> killing the Session at this point (because of timeout). So therefore it
> shouldn't have to be "psychic" to implement a "Pre-end-Session." Further, I
> have experimented a little and, in fact, I *can* get objects back out of the
> Session within the Global.asax Session_End() event. There are some strange
> differences, but simple objects in Session[] seem to be reliably available.
> Alex
> "Juan T. Llibre" wrote:
>
>> re:
>> !> I still don't know why objects in the session seem to be gone
>> !> by the time Session_End occurs.
>>
>> When the Session_End event fires it's because the session is already gone,
>> either due to a session timeout or to Session.Abandon having been called in code.
>>
>> ASP.NET would need to be psychic in order to have a "Pre_Session_End" event.
>>
>> The only built-in objects available from within the
>> Session_End event handler are Server and Application.
>>
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espańol : http://asp.net.do/foros/
>> ======================================
>> "Alex Maghen" <> wrote in message
>> news:47FF2089-A2AC-4F9F-8364-...
>> > More about this - I *have* figure out that if I set the timeout to something
>> > short. But I still don't know why objects in the session seem to be gone by
>> > the time Session_End occurs.
>> >
>> > "Alex Maghen" wrote:
>> >
>> >> Hi. I am trying to maintain a list of people who are currently "online" in
>> >> SQL. I do this by adding a simple entry to a simple PeopleOnline table
>> >> whenever someone logs in to my site.
>> >>
>> >> If they manually log OUT of the site, I have no problem deleting them from
>> >> the PeopleOnline table. But if they just close the browser, I was assuming
>> >> I'd have to use the Session_End() event in Global.asax even though I know
>> >> that this will only occur once the user's session has timed out.
>> >>
>> >> But I have two questions about this:
>> >>
>> >> 1. When this even occurs, can I still access that user's Session? In other
>> >> words, inside the Session_End() function, can I reference the Session[]
>> >> object?
>> >>
>> >> 2. During development from VS2005, how do I test this? The problem is that
>> >> when I close the broswer that I use from within VS, everything sort of dies
>> >> so I don't think that the Session_End() ever occurs. How can I debug?
>> >>
>> >> Thanks.
>> >>
>> >> Alex
>>
>>
>>
>>