Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

global.asax application_end

Status
Not open for further replies.

KDavie

Programmer
Feb 10, 2004
441
US
Can anyone tell me when this event actually fires?

I thought that whenever a user either closes the browser by pressing 'X' or when the user types in a new URL this event would fire, however that doesn't seem to be working that way when I try to run the app.

I've noticed that the event does fire when I rebuild the app or when I restart visual studio (when it actually opens again, not when it closes).

I don't understand this behavior.

I need to run some simple cleanup code to ensure that record locks are removed if a user exits the app in one of the afore mentioned ways.

Any info would be appreciated.
 
When the app starts first time the Application_Start fires. (server)
Also the Session_Start too.
Then the Session_End as soon as the is expiration (defined in web.config-default is 20 mins or 30).

These all happen to the server, so by clicking the 'x' the browser does not know.
Now you can imagine when Application_end fires...

Hope these help.
 
Gotcha....

So is there anyway to determine when a user explicitly ends a session?

I read an article that said session_end is fired when it expires or when the user closes the browser, but this doesn't appear to be the case.

I need to figure out a way to make sure record locks are being removed if a user fails to click the "Done" button.

Any ideas of how I could accomplish this?
 
The way I've worked around this kinda sucks, but every time a user navigates to a page in my site, I update a datetime field on the user record. I have a DTS package that runs every 5 mins that removes locks for a user that hasn't navigated to a page within 15 mins of the last time that datetime field was updated.

 
There is no foolproof method to know when the user closes their browser window so I'd give up going down that route! There are workarounds and the only method that will work is basically having a timer that cleans up after these users (like tperri has suggested).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Thanks for the suggestions, I suppose I will go the timer route.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top