If I have two controller actions:
[HttpGet] public ActionResult Login() {
and
[HttpPost] public ActionResult Login(FormCollection values) {
This seems to require Post design (this makes sense), but HttpGet decoration is completely optional. It works great with or without. MVC seems to control the behavior of the HttpGet controller by default, unless otherwise specified.
I need to decide if I want the future reader of my code to have to figure it out on my own or not, or if I want to forget to add HttpGet everywhere for consistency. But my question is not whether it is good practice to include an explicit decoration, even if it is not already made.
My question is: ALWAYS it happens that I donβt need to decorate HttpGet controller methods? Is there any way that this can bite me if I do this or explicitly do not indicate? I searched for this, but all I can find are posts describing why you can use both annotations and not the reason / cons, including HttpGet.
jtheis
source share