473,699 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clicking Refresh Button Resubmits Form

I have a form that submits data to a database. If I click the browser's
refresh button after submitting the form once, the form is submitted a
second time. How can I avoid this problem? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
Nov 21 '05 #1
8 2399
Nathan,

You could send the results page a response.redire ct or go to a different
page with a meta refresh. Either way, you need to get the client machine to
a page that wasn't produced by submitting form data. So the logic would be:

Client posts form data on submit.

Server processes data and stores results for future display (if necessary)
in a session variable or elswhere.

Server sends client as the result of the form post a redirect or meta
refresh which sends client to a new page that wasn't produced via posted
data.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
I have a form that submits data to a database. If I click the browser's
refresh button after submitting the form once, the form is submitted a
second time. How can I avoid this problem? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Nov 21 '05 #2
Would the Page.IsPostback work for you?

Rgs, Phil

"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
I have a form that submits data to a database. If I click the browser's
refresh button after submitting the form once, the form is submitted a
second time. How can I avoid this problem? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Nov 21 '05 #3
I tried the Page.IsPostback () and it doesn't help. If I use the condition
Not Page.IsPostback () then I can't submit at all, and if I use
Page.IsPostback () it still gives me the resubmitting problem with the
refresh button.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Phil G." <Ph**@nospam.co m> wrote in message
news:dg******** **@nwrdmz02.dmz .ncs.ea.ibs-infra.bt.com...
Would the Page.IsPostback work for you?

Rgs, Phil

"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
I have a form that submits data to a database. If I click the browser's
refresh button after submitting the form once, the form is submitted a
second time. How can I avoid this problem? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/


Nov 21 '05 #4
Nathan,

Any reason why you have the newsgroup AdoNet in this crossposting. In other
words, with what can we help you that is AdoNet related?

Cor
Nov 21 '05 #5
Phil G. wrote:
Would the Page.IsPostback work for you?


This will not work, as refresh resends the last request. A POST thus
stays a POST...

Cheers,
--
http://www.joergjooss.de
mailto:ne****** **@joergjooss.d e
Nov 21 '05 #6
Build Your ASP.NET Pages on a Richer Bedrock
http://msdn.microsoft.com/asp.net/co...rockaspnet.asp

Eliyahu

"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
I have a form that submits data to a database. If I click the browser's
refresh button after submitting the form once, the form is submitted a
second time. How can I avoid this problem? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

Nov 21 '05 #7
Go through Teri's article at:-
http://aspalliance.com/687
It should help
Patrick
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:eo******** ******@tk2msftn gp13.phx.gbl...
Build Your ASP.NET Pages on a Richer Bedrock
http://msdn.microsoft.com/asp.net/co...to/default.asp
x?pull=/library/en-us/dnvs05/html/bedrockaspnet.a sp
Eliyahu

"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
I have a form that submits data to a database. If I click the browser's
refresh button after submitting the form once, the form is submitted a
second time. How can I avoid this problem? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/


Nov 21 '05 #8
use Redirect to give output that means with redirect the output page
will be different and now postback will not be there

Nov 21 '05 #9

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

Similar topics

6
3330
by: laura | last post by:
I'm doing a page which gathers some text in the form of a text box in a <form>. This text is saved to a text file, notices.txt and I want to be able to display the saved text on the page, as soon as they click the SUBMIT button - is this possible? At the moment I have a hyperlink called "back" which, once they have entered the text and they click SUBMIT, the "back" hyperlink will refresh the page and it displays the newly entered text....
2
3814
by: anonieko | last post by:
Scenario: You have a page that is TOO slow to refresh. But it allows partial flushing of html contents. I.e. Submit button already appears but you don't want your users to click on it prematurely because other parts are still coming. Here I put a javascript the will enable only submit button only after 5 seconds after the page is load fully.
0
4228
by: lucas | last post by:
Hi, I have a simple input form that i use to add records to a sql server database. Bellow that is a datagrid that has one template column that I use to dispaly the 3 fields with some html formating. the datagrid also has paging. I'm doing a ASP.NET guestbook. I know some things could be improved like adding some error handling and caching the dataset instead of querying the database on every page load....but I'm still working on the...
10
9242
by: tasmisr | last post by:
This is an old problem,, but I never had it so bad like this before,, the events are refiring when clicking the Browser refresh button. In the Submit button in my webform, I capture the server side click event and I update session information to track the visibilty of some panels in a wizard type navigation ("Next >>" and "<< Back" buttons).. but the refresh button makes another event firing and takes the whole thing to a Choes.. ...
9
7763
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't remember that I clicked a button before the refresh. Here is what is going on: 1) Page Loads 2) User enters some values, clicks the "Save" button 3) The onClick event handler for the save button saves the data to the database and the page is...
8
1711
by: Nathan Sokalski | last post by:
I have a form that submits data to a database. If I click the browser's refresh button after submitting the form once, the form is submitted a second time. How can I avoid this problem? Thanks. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/
9
1526
by: Mr Newbie | last post by:
Before someone flames me, I know this is the VB.NET groups, nonetheless, the asp.net guys seems to have almost disapeared from the aspnet groups so I thought I would ask this here. I have a problem with an aspx web form in that if I refresh, it simply resubmits the form and causes multiple submissions, in this case the form is one which adds records to the database and refreshing a previously submitted item repeats each time the refresh...
2
276
by: Mr Newbie | last post by:
Before someone flames me, I know this is the VB.NET groups, nonetheless, the asp.net guys seems to have almost disapeared from the aspnet groups so I thought I would ask this here. I have a problem with an aspx web form in that if I refresh, it simply resubmits the form and causes multiple submissions, in this case the form is one which adds records to the database and refreshing a previously submitted item repeats each time the refresh...
10
3783
by: Martien van Wanrooij | last post by:
In a simple webshop application I am trying to check that the "shopping cart" only should be "filled" when you choose an article in "meerinfo.php" and click on a link to "winkelwagen.php". It works fine in that sense that when I would enter in the browser "www.mysite.php/winkelwagen?id=5"it will be ignored. However when I go from meerinfo.php to winkelwagen.php , the article is added again and again to the shopping cart when I click on...
9
4137
by: Navaneet | last post by:
Hi, Can anyone tell me how to prevent some particular POST DATA when refresh button (F5) clicked on server side(vb.net). Thanks Kumar N
0
8613
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
9032
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...
1
8908
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7745
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
5869
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
4374
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
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.