By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,187 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,187 IT Pros & Developers. It's quick & easy.

global.aspx and session_end event

P: n/a
When I call the session.abandon() method, it calls the session_end event.
When a user closes the browser or clicks the log off button, I can dispose
of objects and abandon the session cleaning. But, when a user either
navigates away from the web app and when the session timesout, the
session_end event does not seem to fire. Or when else can I dispose of
objects? Or is there an event I can you that is fired when a user navigates
away from the web app?
Aug 16 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
After 20 minutes or whatever your IIS session timeout variable is the session_end event should be called.
If doesn't seem to be be working then check your IIS settings.

mnichols

Roger wrote:
When I call the session.abandon() method, it calls the session_end event.
When a user closes the browser or clicks the log off button, I can dispose
of objects and abandon the session cleaning. But, when a user either
navigates away from the web app and when the session timesout, the
session_end event does not seem to fire. Or when else can I dispose of
objects? Or is there an event I can you that is fired when a user navigates
away from the web app?
Aug 16 '06 #2

P: n/a
found out, the event is being called, but I want to dispose (or clean up)
objects that was used within the web app. put the call within a try and wrote
to a event viewer. But, when I call the dispose method, it returned that the
"Object reference not set to an instance of an object." But, it did not
really release cleanly. Cause if user clicks on the Log off button on the web
app, it will call the dispose method and it shut down all dependent objects.
Any ideas around this?

"mnichols" wrote:
After 20 minutes or whatever your IIS session timeout variable is the session_end event should be called.
If doesn't seem to be be working then check your IIS settings.

mnichols

Roger wrote:
When I call the session.abandon() method, it calls the session_end event.
When a user closes the browser or clicks the log off button, I can dispose
of objects and abandon the session cleaning. But, when a user either
navigates away from the web app and when the session timesout, the
session_end event does not seem to fire. Or when else can I dispose of
objects? Or is there an event I can you that is fired when a user navigates
away from the web app?
Aug 16 '06 #3

P: n/a
Sounds like a garbage collection issue. Somehow you need to determine if the objects have already been released or not and then when they are released that they are released completely.
The LogOff button should trigger a Session.Abandon which is what session_end should do. If there are subtle differences then I am sot sure I can help.
Maybe someone else has beeter insights.

mnichols
Roger wrote:
found out, the event is being called, but I want to dispose (or clean up)
objects that was used within the web app. put the call within a try and wrote
to a event viewer. But, when I call the dispose method, it returned that the
"Object reference not set to an instance of an object." But, it did not
really release cleanly. Cause if user clicks on the Log off button on the web
app, it will call the dispose method and it shut down all dependent objects.
Any ideas around this?

"mnichols" wrote:
>After 20 minutes or whatever your IIS session timeout variable is the session_end event should be called.
If doesn't seem to be be working then check your IIS settings.

mnichols

Roger wrote:
>>When I call the session.abandon() method, it calls the session_end event.
When a user closes the browser or clicks the log off button, I can dispose
of objects and abandon the session cleaning. But, when a user either
navigates away from the web app and when the session timesout, the
session_end event does not seem to fire. Or when else can I dispose of
objects? Or is there an event I can you that is fired when a user navigates
away from the web app?
Aug 16 '06 #4

P: n/a
yes, my logoff functionality is working. What I am trying to do if if user
just navigates away from the web app without clicking the log off button.
Cannot always assume the users is going to follow instructions to the dot.
so, when the session timeouts, it does call the session_end event, but, does
not dispose of my objects cleanly. And that is what I am trying to figure out
now. Hope you or someone might have some insight.

"mnichols" wrote:
Sounds like a garbage collection issue. Somehow you need to determine if the objects have already been released or not and then when they are released that they are released completely.
The LogOff button should trigger a Session.Abandon which is what session_end should do. If there are subtle differences then I am sot sure I can help.
Maybe someone else has beeter insights.

mnichols
Roger wrote:
found out, the event is being called, but I want to dispose (or clean up)
objects that was used within the web app. put the call within a try and wrote
to a event viewer. But, when I call the dispose method, it returned that the
"Object reference not set to an instance of an object." But, it did not
really release cleanly. Cause if user clicks on the Log off button on the web
app, it will call the dispose method and it shut down all dependent objects.
Any ideas around this?

"mnichols" wrote:
After 20 minutes or whatever your IIS session timeout variable is the session_end event should be called.
If doesn't seem to be be working then check your IIS settings.

mnichols

Roger wrote:
When I call the session.abandon() method, it calls the session_end event.
When a user closes the browser or clicks the log off button, I can dispose
of objects and abandon the session cleaning. But, when a user either
navigates away from the web app and when the session timesout, the
session_end event does not seem to fire. Or when else can I dispose of
objects? Or is there an event I can you that is fired when a user navigates
away from the web app?
Aug 16 '06 #5

P: n/a
>From what I understand with the discussion until now, you have some
code that cleans up your objects in user logoff function, but the same
code is not working if you place it in Session_End event handler. Is
that right?

If not, If users are simply navigating away from your application
without clicking logoff, how are you handling the object cleanup?
Remember server has no idea as what user does on the browser, unless he
sends a HTTP request

P.S: Session_End would not have access to HTTP request and response
handlers

Roger wrote:
yes, my logoff functionality is working. What I am trying to do if if user
just navigates away from the web app without clicking the log off button.
Cannot always assume the users is going to follow instructions to the dot.
so, when the session timeouts, it does call the session_end event, but, does
not dispose of my objects cleanly. And that is what I am trying to figure out
now. Hope you or someone might have some insight.

"mnichols" wrote:
Sounds like a garbage collection issue. Somehow you need to determine if the objects have already been released or not and then when they are released that they are released completely.
The LogOff button should trigger a Session.Abandon which is what session_end should do. If there are subtle differences then I am sot sure I can help.
Maybe someone else has beeter insights.

mnichols
Roger wrote:
found out, the event is being called, but I want to dispose (or clean up)
objects that was used within the web app. put the call within a try and wrote
to a event viewer. But, when I call the dispose method, it returned that the
"Object reference not set to an instance of an object." But, it did not
really release cleanly. Cause if user clicks on the Log off button on the web
app, it will call the dispose method and it shut down all dependent objects.
Any ideas around this?
>
"mnichols" wrote:
>
>After 20 minutes or whatever your IIS session timeout variable is the session_end event should be called.
>If doesn't seem to be be working then check your IIS settings.
>>
>mnichols
>>
>Roger wrote:
>>When I call the session.abandon() method, it calls the session_end event.
>>When a user closes the browser or clicks the log off button, I can dispose
>>of objects and abandon the session cleaning. But, when a user either
>>navigates away from the web app and when the session timesout, the
>>session_end event does not seem to fire. Or when else can I dispose of
>>objects? Or is there an event I can you that is fired when a user navigates
>>away from the web app?
Aug 16 '06 #6

P: n/a
You need to be more specific about what "objects" need to be disposed (or
even if that is necessary), and be aware of the fact that they may already be
gone anyway.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Roger" wrote:
yes, my logoff functionality is working. What I am trying to do if if user
just navigates away from the web app without clicking the log off button.
Cannot always assume the users is going to follow instructions to the dot.
so, when the session timeouts, it does call the session_end event, but, does
not dispose of my objects cleanly. And that is what I am trying to figure out
now. Hope you or someone might have some insight.

"mnichols" wrote:
Sounds like a garbage collection issue. Somehow you need to determine if the objects have already been released or not and then when they are released that they are released completely.
The LogOff button should trigger a Session.Abandon which is what session_end should do. If there are subtle differences then I am sot sure I can help.
Maybe someone else has beeter insights.

mnichols
Roger wrote:
found out, the event is being called, but I want to dispose (or clean up)
objects that was used within the web app. put the call within a try and wrote
to a event viewer. But, when I call the dispose method, it returned that the
"Object reference not set to an instance of an object." But, it did not
really release cleanly. Cause if user clicks on the Log off button on the web
app, it will call the dispose method and it shut down all dependent objects.
Any ideas around this?
>
"mnichols" wrote:
>
>After 20 minutes or whatever your IIS session timeout variable is the session_end event should be called.
>If doesn't seem to be be working then check your IIS settings.
>>
>mnichols
>>
>Roger wrote:
>>When I call the session.abandon() method, it calls the session_end event.
>>When a user closes the browser or clicks the log off button, I can dispose
>>of objects and abandon the session cleaning. But, when a user either
>>navigates away from the web app and when the session timesout, the
>>session_end event does not seem to fire. Or when else can I dispose of
>>objects? Or is there an event I can you that is fired when a user navigates
>>away from the web app?
Aug 16 '06 #7

P: n/a
From what I understand with the discussion until now, you have some
code that cleans up your objects in user logoff function, but the same
code is not working if you place it in Session_End event handler. Is
that right?
That is correct. If they navigate away, the session_end event is called when
the session has timed out. But, in the function, when I attempt to call the
dispose method of the object, it throws an error "Object reference not set to
an instance of an object." But, I know it did not dispose properly cause when
the object is called it starts a process inthe task manager I can monitor. If
I press the log off button, I see the process clear out of the task manager.
But, if the timeout is fired, the process is still running on the task
manager.

"Kumar Reddi" wrote:
From what I understand with the discussion until now, you have some
code that cleans up your objects in user logoff function, but the same
code is not working if you place it in Session_End event handler. Is
that right?

If not, If users are simply navigating away from your application
without clicking logoff, how are you handling the object cleanup?
Remember server has no idea as what user does on the browser, unless he
sends a HTTP request

P.S: Session_End would not have access to HTTP request and response
handlers

Roger wrote:
yes, my logoff functionality is working. What I am trying to do if if user
just navigates away from the web app without clicking the log off button.
Cannot always assume the users is going to follow instructions to the dot.
so, when the session timeouts, it does call the session_end event, but, does
not dispose of my objects cleanly. And that is what I am trying to figure out
now. Hope you or someone might have some insight.

"mnichols" wrote:
Sounds like a garbage collection issue. Somehow you need to determine if the objects have already been released or not and then when they are released that they are released completely.
The LogOff button should trigger a Session.Abandon which is what session_end should do. If there are subtle differences then I am sot sure I can help.
Maybe someone else has beeter insights.
>
mnichols
>
>
Roger wrote:
found out, the event is being called, but I want to dispose (or clean up)
objects that was used within the web app. put the call within a try and wrote
to a event viewer. But, when I call the dispose method, it returned that the
"Object reference not set to an instance of an object." But, it did not
really release cleanly. Cause if user clicks on the Log off button on the web
app, it will call the dispose method and it shut down all dependent objects.
Any ideas around this?

"mnichols" wrote:

After 20 minutes or whatever your IIS session timeout variable is the session_end event should be called.
If doesn't seem to be be working then check your IIS settings.
>
mnichols
>
Roger wrote:
>When I call the session.abandon() method, it calls the session_end event.
>When a user closes the browser or clicks the log off button, I can dispose
>of objects and abandon the session cleaning. But, when a user either
>navigates away from the web app and when the session timesout, the
>session_end event does not seem to fire. Or when else can I dispose of
>objects? Or is there an event I can you that is fired when a user navigates
>away from the web app?
>

Aug 16 '06 #8

P: n/a
"Roger" <Ro***@discussions.microsoft.comwrote in message
news:46**********************************@microsof t.com...
That is correct. If they navigate away, the session_end event is called
when
the session has timed out. But, in the function, when I attempt to call
the
dispose method of the object, it throws an error "Object reference not set
to
an instance of an object." But, I know it did not dispose properly cause
when
the object is called it starts a process inthe task manager I can monitor.
If
I press the log off button, I see the process clear out of the task
manager.
But, if the timeout is fired, the process is still running on the task
manager.
See Peter's reply...

Do the following:

1) Set your Session timeout to 1 minute

2) Set a breakpoint at the very top of your Session_End method

3) Start your web project in debug mode (Ctrl-F5)

4) FROM ANOTHER BROWSER WINDOW, access your site

5) Log in as normal

6) Don't log out cleanly - instead, just close the browser

7) Wait patiently for 60 seconds until the Session_End fires - now step
through, identify the problem and fix it... :-)
Aug 16 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.