473,763 Members | 3,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

global.aspx and session_end event

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
8 5769
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
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
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
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
>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
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
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
"Roger" <Ro***@discussi ons.microsoft.c omwrote in message
news:46******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1874
by: raj | last post by:
Hi, I am facing a problem of automatic session timeout problem and automatic session_end event fired. Case1: As I have analyzed I get to know that the default session timeout is 20 in web.config, If I reassign the session timeout at login page other than the time which is defined at web.config(20 Min.) then automatic session_end (in global.aspx.cs) event fired. Why automatic this event is fired??
5
2806
by: Steve M | last post by:
Why are my sessions lasting so long? I have them set to 20 minute timeout in config file? The Session_End event is getting called an hour or more sometimes--well after the user has stopped interacting with my site. Anyone have any insight? Thanks in advance
3
1650
by: Mark Field | last post by:
Assuming that IIS is not restared, and that the web server is not restarted, should the "session_end" event in the global file ALWAYS fire or will there be times when it will not fire? protected void Session_End(Object sender, EventArgs e) { }
7
1753
by: T. | last post by:
Does the Session_End event actually fire? I am building an ASP.NET application, and so far I have an HTML page and a single asp page. The HTML is the home page. I have code in the Global.asax file's Session_End handler that closes the session's connections to the SQL backend. The thing never fires! After my app closes, I run sp_who in Query Analyzer to see connections to the database. Low and behold my ASP connections are still there! What...
11
2825
by: OldProgrammer | last post by:
All the documentation and discussion I have read indicate that the Session_End is not supposed to fire unless you are in "inProc" Session state mode, and then only on Session Timeout or at Session Abandon. I need the event to fire at Session timeout in order to capture and store the Datetime this occurs. However in the application I am writing, I have been unable discern any indication that the event is firing. I have used break...
5
6729
by: news.microsoft.com | last post by:
We are logging many events on our application but cant seem to discover how to determine who the user was in the session end event, as any session storage seems to have disapeared at the point at which the event fires. In essence, I want to log when a users session expires. Any inspiration would be appreciated.
1
6937
by: =?Utf-8?B?YnJlbnQ5NjA=?= | last post by:
Environment: ASP.NET 2.0, SQL Server 2005, C#, Visual Studio 2005 In my Session_End event, I am executing a stored procedure to update a database table that is used to log user sessions. When the user sessions time out, the Session_End event fires successfully. The stored procedure executes successfully, and I can see the updated data in the database just as I would expect. Nonetheless, an exception is being generated by the code...
2
1277
by: jamal idba | last post by:
Hello, I'm working with web developper express edition. I have a global.asax. I have a web application all ready. The problem is : Session_End event is never raised. I have in my web.config file : <sessionState timeout="6" mode="InProc" cookieless="true"
12
10698
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
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...
0
10149
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10003
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9943
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9828
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8825
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5410
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3918
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2797
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.