By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,503 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

Clicking Refresh Button Resubmits Form

P: n/a
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********@hotmail.com
http://www.nathansokalski.com/
Nov 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Nathan,

You could send the results page a response.redirect 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********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.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********@hotmail.com
http://www.nathansokalski.com/

Nov 21 '05 #2

P: n/a
Would the Page.IsPostback work for you?

Rgs, Phil

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.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********@hotmail.com
http://www.nathansokalski.com/

Nov 21 '05 #3

P: n/a
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********@hotmail.com
http://www.nathansokalski.com/

"Phil G." <Ph**@nospam.com> 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********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.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********@hotmail.com
http://www.nathansokalski.com/


Nov 21 '05 #4

P: n/a
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

P: n/a
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.de
Nov 21 '05 #6

P: n/a
Build Your ASP.NET Pages on a Richer Bedrock
http://msdn.microsoft.com/asp.net/co...rockaspnet.asp

Eliyahu

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.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********@hotmail.com
http://www.nathansokalski.com/

Nov 21 '05 #7

P: n/a
Go through Teri's article at:-
http://aspalliance.com/687
It should help
Patrick
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eo**************@tk2msftngp13.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.asp
Eliyahu

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.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********@hotmail.com
http://www.nathansokalski.com/


Nov 21 '05 #8

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.