473,770 Members | 6,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Saving Data When ASP.Net Page Unloads

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 radio buttons and text boxes. At the bottom of the page is a button
that he is to click when he's done. The event behind the button will write
the data to the database and redirect him to a Thanks page.
The issue is what happens if the user supplies the data, then just closes
the browser window. As it is, the data doesn't get written. There is a
Page_Unload event that I don't understand completely. First, it fires when
the page has finished loading, which I've read is expected, and second, when
the page is closed there doesn't seem to be much you can actually do there,
as by the time the event fires, the session is closed. That is documented as
well.
My question is: how can I ensure the data gets written? Are there
traditional ways to stop a browser window from being closed, or at least to
call another sub when it is?


Roy Scarisbrick, B.A. (Economics), Certified Engineering Technologist

Calgary, Alberta, Canada, T2P 4H3

www.HeadwaySystems.com
Nov 17 '05 #1
2 2157
Hi,

If you use just IE you can use the OnBeforeUnload with XMLHTTP or
webservice.htc to accomplish it.

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2
I don't think you want the data if the user closes the window.

Most people know how to use a web page. capturing the data when the window
closes, or without the users direct action makes the value of the data
suspect.

"Roy Scarisbrick" <ro*@headwaysys tems.com> wrote in message
news:PS******** *************** @news3.calgary. shaw.ca...
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 radio buttons and text boxes. At the bottom of the page is a button
that he is to click when he's done. The event behind the button will write
the data to the database and redirect him to a Thanks page.
The issue is what happens if the user supplies the data, then just closes
the browser window. As it is, the data doesn't get written. There is a
Page_Unload event that I don't understand completely. First, it fires when
the page has finished loading, which I've read is expected, and second, when the page is closed there doesn't seem to be much you can actually do there, as by the time the event fires, the session is closed. That is documented as well.
My question is: how can I ensure the data gets written? Are there
traditional ways to stop a browser window from being closed, or at least to call another sub when it is?


Roy Scarisbrick, B.A. (Economics), Certified Engineering Technologist

Calgary, Alberta, Canada, T2P 4H3

www.HeadwaySystems.com

Nov 17 '05 #3

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

Similar topics

4
10285
by: KS | last post by:
Is it possible to write a javascript that makes a popup window when someone click on buttons/href on my page and close itself when the new page is about to get loaded? I want to prevent the user from clicking anything else on my page while the request is getting a new page. The popup window must lock the focus. I use frames i can not just disable all the buttons an href in different frames.
17
1590
by: Jack | last post by:
Hi, This is a strange problem I am encountering. I have a asp page with a confirmation.asp page that saves data to a table. There are few text fields that are captured by the confirmation page as l_f_name = Request.Form("txt_Name") l_f_personstitle = Request.Form("txt_Title") l_f_PhoneAreaCode = Request.Form("txt_PhoneAreaCode") l_f_Phone1 = Request.Form("txt_Phone1") l_f_Phone2 = Request.Form("txt_Phone2") l_f_Date =...
2
1215
by: Børge Hansen | last post by:
Hi. I am trying to create functionality for saving the contents (state) of a page. The idea is that when navigating away from a webpage and later returning the state of the textboxes, etc should be reinstated.... Just like Viewstate, but not.... Basicly I have a tabbed GUI and wants to make the webapp work like a winform with tabs....
3
4573
by: RCS | last post by:
I have an app that I have different "sections" that I want to switch back and forth from, all while having the server maintain viewstate for each page. In other words, when I am on Page1.aspx and set textboxes, radio buttons, etc - that viewstate is fine. Then I have a linkbutton that does a Server.Transfer over to Page2.aspx. When I Server.Transfer back to Page1.aspx, the viewstate info is lost. I ran across another example of this last...
0
1127
by: DKode | last post by:
Hello, I am trying to call a UserControl after postback to save data filled out on that usercontrol to sql server. The problem I am having is this, I have 2 LinkButtons that I have setup as tabs on my app, the user fills out information on UserControl_1, when they click a different tab, I want to load UserControl_2 and save the data that was entered into UserControl_1.
4
6724
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 code ?? thank you Pedro Leite From Portugal ------------------------------------
6
8124
by: Jeff | last post by:
Hey (and thank you for reading my post) In visual web developer 2005 express edition I've created a simple website project.. At this website I want users who register to be able to upload a picture of themselves to their profile... I admit that I'm a newbie... but this is how I understand this:
1
2413
by: killygolaman | last post by:
Hi Guys, Have been looking at this for a while and not sure if there is a solution but hopefully someone can point me in the right direction: The problem is essential I want to undo an update if the user unloads a page but not if they just refresh the page. Detail: I have 2 asp pages. Page 1 solicits some information and updates the database. This information is then posted to Page 2, where further details are entered and a final...
0
9592
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10059
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...
0
9871
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
8887
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
6679
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
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.