Click here to Skip to main content
15,905,008 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Evening Friends,
I am designing a web application. I need to cancel the Retry/Cancel Pop-Up while pressing F5 . Because duplicate values are entered in database
Posted

1 solution

This is due to how browsers work. The first time you POST the page, the browser sends all the data, then returns back HTML to render. If you hit refresh (F5) then the browser re-sends the last POST request thus re-sending the information again. This causes duplication of record. One need to apply Post-Redirect-Get pattern for such scenarios/pages, where after an HTTP Post, instead of returning HTML, is redirected back to a page (either the same or another).

In case, you cannot redirect or not comfortable with redirect, have a look at these articles:
Refresh Page Issue in ASP.Net[^]
Stop Refresh after Submitting your Request[^]
Detecting Page Refresh[^]
 
Share this answer
 
Comments
Maciej Los 5-Sep-12 8:02am    
+5 as always!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900