Search code examples
c#asp.net-mvcasp.net-mvc-routingasp.net-mvc-5attributerouting

Mvc 5 Attribute Routing


I am trying to use the build-in attribute routing that comes with Mvc 5, previously I was using the AttributeRouting package on Nuget.

But how do i set up routes by specifying whether it is for a Get or Post request?

In AttributeRouting there was GET() and POST() attributes, but in Mvc 5 there is only a Route() Attribute?


Solution

  • You can still use the PostAttribute in MVC5, it's fully supported.

    "The earlier style of routing, called convention-based routing, is still fully supported. In fact, you can combine both techniques in the same project."

    source