Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restrict attribute routes to specific HTTP verbs

With the AttributeRouting library I can restrict a route to a specific verb:

[Route("customers", HttpVerbs.Post)]

In MVC 5 AttributeRouting is built in, but there is no overload taking HttpVerbs. How do I restrict a route to POST in this case?

like image 431
CMircea Avatar asked Nov 11 '22 19:11

CMircea


1 Answers

You can specify the [HttpGet()], [HttpPost()], [HttpPut()] to restrict the method to one or more supported Http method,

like image 189
jd4u Avatar answered Jan 04 '23 03:01

jd4u