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).
You can disable the submit button using javascript. For example using jQuery:
$(function() { $('form').submit(function() { $(':submit, :image', this).attr('disabled', 'disabled'); }); });
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.