How do the httppost, httpput etc attributes in ASP.NET MVC 2 work?
Posted
by Tomas Lycken
on Stack Overflow
See other posts from Stack Overflow
or by Tomas Lycken
Published on 2010-04-15T20:34:18Z
Indexed on
2010/04/15
20:43 UTC
Read the original article
Hit count: 459
In ASP.NET MVC 2, a couple of new action filter attributes were introduced, as "shorthand" for attributes in ASP.NET MVC 1; for example, applying the HttpPostAttribute
does the same thing as applying [AcceptVerbs(HttpVerbs.Post)]
to an action method.
In addition, with the more verbose syntax, it is possible to combine different methods, in order to allow for example both Post
and Delete
.
Now I'm wondering: how do the new attributes work? If I apply both [HttpPost]
and [HttpDelete]
, will ASP.NET MVC 2 allow both or require both (thus allowing nothing)?
© Stack Overflow or respective owner