Hi All,
I have a C# ASP.NET page that submits back to itself to insert details
from a form into a database table. When / if the user refreshes the
page (and gets the standard warning that POST data will be
resubmitted), the previously submitted record is sumbitted again, and a
duplicate record is inserted into the table.
In PHP I would have avoided this by submitting the form to a processing
page, which would then automatically redirect back to the form page to
display success, etc. So, it would look something like this in PHP:
dataentry.php --> processdataentry.php --> dataentry.php
Doing this would avoid a duplicate record being inserted if
dataentry.php was refreshed.
I'm wondering how the same issue is handled in C# in ASP.NET? Do you
essentially do the same thing? ie submit the form to a processing .aspx
file and then redirect back to the dataentry page? Or is there a way of
avoiding duplicate insertions (aside from setting up unique indexes on
the underlying table - unfortunately, duplicates *are* at times
legitimate, so I can't assume that the existence of any duplicate means
that the page was incorrectly refreshed) while still posting back to
the same page?
Any help appreciated!!
Much warmth,
planetthoughtful
---
"Lost in thought"
http://www.planetthoughtful.org