Saturday, June 11, 2016

[HttpGet]

This attribute for an MVC action is kind of like the [HttpPost] action save that it is for what happens when a user just visits the route to the action in lieu of posting a form to that route. If you have a form at an Index action and it posts to a Save action which just shows the same form again to let you know what you just saved, you could have a breakout between Save for POST and Save for Get wherein the Get will just maybe RedirectToAction back to the Index. This still doesn't protect against someone submitting the form and then refreshing the browser in lieu of just pressing enter at the URL line. The former act will trigger the Post again while the later the Get. However, this sort of breakout does help some I suppose.

No comments:

Post a Comment