saving data when browser is closed

  • Thread starter Thread starter Nikhil Patel
  • Start date Start date
N

Nikhil Patel

Hi all,
I am writing an ASP.Net app. I first read application data from Sql Server
and store it in a DataSet. When the user is no longer running the
application, I would like to save the contents of the DataSet. I know I can
probably use Page_Unload event. But will the Page_Unload event fire if the
user closes the browser window?

Thanks.
-Nikhil
 
Nikhil said:
Hi all,
I am writing an ASP.Net app. I first read application data from Sql
Server and store it in a DataSet. When the user is no longer running
the application, I would like to save the contents of the DataSet. I
know I can probably use Page_Unload event. But will the Page_Unload
event fire if the user closes the browser window?

You can use the Session_End event in your HttpApplication class (e.g.
global.asax). This will fire once the sssion's timeout kicks in or it is
terminated by a user action that class HttpSession.Abandon(). This works
only for InProc sessions, though.

Cheers,
 
As far as session_end event goes.... I've never had it
reliably fire. Or in the event it DOES fire... it doesnt
always appear to have access to the same data.

I had something that when their session expired it'd just
clear out application data that was registered with their
user (old code of somone elses design)

Sometimes the reference to application was avaliable,
sometimes it wasnt.

WEs
 
Back
Top