Prevent Web Application Concurrent Calling (ASP.NET MVC)

What is the best way to ensure that an ASP.NET MVC action is not invoked twice (i.e. if the user presses the button twice twice in a row)? On most of our screens, this does not really matter if this happens ... but on some of them it causes chaos (for example, paying people several times, and not just once).

+4
source share
2 answers

You can disable the submit button using javascript. For example using jQuery:

$(function() { $('form').submit(function() { $(':submit, :image', this).attr('disabled', 'disabled'); }); }); 
+7
source

There was a recent thread about this (with Darin actually).

The combination of what he mentioned and implementing Post-Redirect-Get covers most of the holes.

+6
source

All Articles