Handling a button click in MVC, why is there a string parameter?

I'm following this awful textbook, going through the basics of create/edit/delete records. The delete bit has a confirm button, and it is handled like so:

public ActionResult Delete(int id, string confirmButton) {

It offers no explanation of why the button is passed as a string or how MVC interprets it.

Can anyone help clarify what's going on here? The Create code has no such string being passed.


My first guess is that they want to make sure that the delete action is called by this confirm button. But it lacks context to tell what it does exactly... You can assign a generated value to the button when rendering the page for the current user. This value will be posted when you post the form using this button. Then you verify that it is the value posted is the same as the one originally posted when proceeding to delete. That would avoid evil-minded people to delete all your records programmatically...

But this book seems a bit old, since you can use the attribute HttpPost insteat of the verbose AcceptVerbAttribute version. Which "awefull" book are you tallking about? There are plenty of resource talking about CRUD operations with mvc. I liked Pro ASP.NET MVC by Apress. Steven Sanderson explains it quite well...

Need Your Help

Exception after adding JAX-RS facet to Dynamic Web Project in Eclipse

eclipse rest ejb-3.0 glassfish-3 jax-rs

I am a newbie to Oracle Plugin for Eclipse (OEPE) and EJB. I am following the tutorial on following the tutorial on http://www.youtube.com/watch?v=on557289GzA&feature=relmfu titled JavaEE6 and