saving data when browser is closed

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
 
J

Joerg Jooss

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,
 
W

Weston Weems

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top