Clicking Refresh Button Resubmits Form

N

Nathan Sokalski

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.
 
S

S. Justin Gengo

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
 
N

Nathan Sokalski

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.
 
C

Cor Ligthert [MVP]

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
 
D

Deepak Dhawan

use Redirect to give output that means with redirect the output page
will be different and now postback will not be there
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top