5

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?

CMircea
  • 3,543
  • 2
  • 36
  • 58

1 Answers1

1

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

jd4u
  • 5,789
  • 2
  • 28
  • 28
  • Is this restriction also added in the route itself? I am using this information when generating a sitemap. – CMircea Oct 24 '13 at 08:22
  • all attributes are related to method not a route. So you can cross query to find httpmethod support. – jd4u Oct 24 '13 at 08:42