[HttpPost] vs [AcceptVerbs(HttpVerbs.Post)]
[HttpPost] vs [AcceptVerbs(HttpVerbs.Post)] is there a difference?
1、
the HttpPost attribute is a short for the HttpVerbs.Post one but since MVC 2.0.
2、
[HttpPost] is shorthand for [AcceptVerbs(HttpVerbs.Post)]. The only difference is that you can't use [HttpGet, HttpPost] (and similar) together on the same action. If you want an action to respond to both GETs and POSTs, you must use [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)].
3、
[AcceptVerbs] is the only way to decorate a method that accepts several (but not all) verbs.
[AcceptVerbs(HttpVerbs.Post | HttpVerbs.Put)]
It's also the only way you can specify a verb that's not one of the "core four", such as those which are part of WebDAV:
[AcceptVerbs("LOCK")]