Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preventing re-posts 2

Status
Not open for further replies.

transparent

Programmer
Sep 15, 2001
333
GB
Scenario -

User fills in a form
Presses submit
Then once the page response has occurred, refreshes the page

Results in double posts.

Has anybody found an elegant solution to this problem?
 
I almost always send a Redirect back to the page after a POST is done. Thus you are never left with the result of a POST on the browser (always a GET), and never have the ugly "This page is the result of a form post and cannot be refreshed" message.

This seems like the simplest way to handle to the problem, but I'm sure there are more complicated ways :-D

You can also send a querystring parameter, indicating the result of the post such as

Response.Redirect("thisform.aspx?message=1")

where "message" is a parameter indicating some result code that you want to display.



[pipe]
Share your knowledge! -
 
I'd second the "redirect" method (although I normally use this to send the user to a confirmation page rather than back to the original page).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Thats pretty much the approach I was planning on taking - just wasnt sure - what with the problem of twice the processing overhead.

Cheers for your thoughts
 
In my case - I'm using this for a comment that users can add to articles.

Again cheers.
 
In that case you have two options really:

1) As dragonwell stated above, redirect back to the same page with a querystring value to indicate that the user has added a comment, and if this querystring vlaue exists, post a confirmation message
2) Redirect to a confirmation page

Option #2 can be extended to say "Thanks, you will be redirected back in x seconds or click here if you do not wish to wait" and give them a link back to the original page.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top