473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

saving data when browser is closed

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
Nov 18 '05 #1
4 3032
Hi Nikhil,

The onunload event is a client-side thing that you might be able to get
working in IE.

Here's an example

http://msdn.microsoft.com/workshop/s...onunloadEX.htm
onunload Event

http://msdn.microsoft.com/library/de...ence_entry.asp
"Nikhil Patel" <ni********@aol.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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


Nov 18 '05 #2
You may be able to take advantage of the client side OnClose event.
Here's more info:
http://www.mozilla.org/docs/dom/domr...dow_ref56.html

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Nikhil Patel" <ni********@aol.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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

Nov 18 '05 #3
Nikhil Patel wrote:
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,

--
Joerg Jooss
jo*********@gmx.net
Nov 18 '05 #4
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
-----Original Message-----
Nikhil Patel wrote:
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 isterminated by a user action that class HttpSession.Abandon (). This worksonly for InProc sessions, though.

Cheers,

--
Joerg Jooss
jo*********@gmx.net
.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Roy Scarisbrick | last post by:
I have a programming issue on an ASP.Net web page. I suspect the issue would apply to any version of ASP though. I have a questionnaire page where a user will answer a bunch of questions with...
6
by: | last post by:
Hi all, is there a better way to stream binary data stored in a table in sql 2005 to a browser in .net 2.0? Or is the code same as in .net 1.1? We noticed that in certain heavy load scenarios,...
2
by: laks | last post by:
Hi I'm opening an aspx page with javascript: window.showModalDialog("mypage.aspx", "", "status:no"); In mypage.aspx I've got a button which shall first save the displayed record in the C# code...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
11
by: Kevin | last post by:
I've been searching forever for examples of saving data changes in a DataGridView. There's all kinds of examples, but none really show how to save changes. Someone please help me. I have a...
7
by: Bam | last post by:
Hey gang. Is there a way, to automatically save a page that is db driven, as a page that contains html? i would like a page like http://tournamentsbyeck.com/past_standings3.asp to be...
6
by: =?Utf-8?B?ZHNoZW1lc2g=?= | last post by:
Hello, I have a windows form with a TreeView control. When I first open the tree all nodes are colapsed. Then, I expand some of them and close the form. When I call Form.showDialog() once again...
3
by: Gouri.Mahajan7 | last post by:
Hello, I am new to asp.net. Can anybody please tell me which event is fired when we close the browser. I want to remove some resources when the browser close button is pressed. Thanks in advance....
5
by: bgold12 | last post by:
When a user logs onto my site, I set some session data using php: .... session_start(); .... $_SESSION = 'value'; .... From what I understand, this should store the session data (i.e. the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
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...
0
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,...

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.