asp.net mvc - [HttpPost/HttpGet] vs. [AcceptVerbs(HttpVerbs.Post/Get)]
Solution 1:
Yes, absolutely the same. [HttpPost/HttpGet]
were introduced in ASP.NET MVC 2 to reduce the keystrokes we have to type :-) [AcceptVerbs(HttpVerbs.Post/Get)]
could still be used and behave the same although if you are writing new code I would recommend the first.
Solution 2:
Yes they are the same but with the newer versions you can only make an action accept requests from one verb. Using [AcceptVerbs(HttpVerbs.Post | HttpVerbs.Get | HttpVerbs.Delete)]
you can accept 2 or more. Also you can use [AcceptVerbs]
to accept other verbs that are not part of the HttpVerbs
enum - eg. [AcceptVerbs("Trace")]
.
I'm not sure why you would ever need to use this functionality but you are able to should you wish.