I'm developing ASP.NET applications and stuck with a "problem" relating to resubmit behaviour. I'm controling the re-submit using a counter in form submit event which disables the submit if it's already been posted. My application is a 3 step workflow and when the 3rd step is shown the transaction was submited from step2 to step 3. What's my problem? Well... i want to avoid the user to resubmit the data by pressing the F5 or all other possibility. I don't want to disable the key because may be workarounds. I'm wondering if i can remove the post data in a HTTP module that runs after the render was completed and right before the response is sent to the user.
Solution 1: Disable Confirm Form Resubmission From Chrome Follow these steps below to disable the confirm resubmission feature from chrome, if you're windows user; Right click on your chorme shortcut, select properties. In the target field, add: “-disable-prompt-on-repost” without the quotes after chrome.exe.
What can pass as a solution to rectifying the Confirm Form Resubmission error is switching the POST method to the entire PRG pattern. Whenever any page needs a form on it, design it in such a way that it does not post the data directly to the server.
First thing you can do is you need to add required field validations to the textboxs. Then you have to empty the texboxes in the button_click event after sqlcommand. You can empty the texboxes using TextBox1. Text = String.
One way to stop page resubmission on page refresh is to unset the form data after it is submitted so that the variable storing form data becomes empty and wrap up your form processing block of codes to check if the form is empty.
You can use Post/Redirect/Get "pattern", where when user post data, you redirect it (after processing submitted data) to another page that will response to get. Just like stackoverflow and another sites are doing.
Here's is the Wikipedia page that explains the Post/Redirect/Get Pattern.
Maybe I misunderstood your question/issue but it sounds like you may be making things harder than they have to be. If you are already keeping track of whether or not the form has been submitted before, why cant you just check that flag on the code behind before performing whatever logic you execute on the submit? If it has already been submitted before, just ignore the resubmit event and maybe set an error message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With