So far we have seen various action filter in ASP.NET MVC which allow us to restrict action method usage based on HTTP verb or method. But with the usage of HttpGet, HttpPost, HttpPut or other such action filter, we are limited to only respective HTTP verb. But sometime we require that action method should be accessible by more than one HTTP verb but not all. This is the case where AcceptVerbs comes in picture.
In this case, we can use AcceptVerbs action filter. Here we can specify list of HTTP verbs and action method would be accessible by only those verbs.
Attribute Usage: Only method
[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
public ActionResult About()
In above example, action method will be accessible by only HTTP GET & POST verbs. Following is the full list of possible value for AcceptVerbs
We can use any combination from above list with AcceptVerbs filter.
Check out ASP.NET MVC: Action filter series post to read about other available action filters.