Attribute routing in asp.net mvc - Tutorial

For Consultation : +91 9887575540

Stay Connected :

Today we are going to discuss a very important concept of MVC 5 and Web API 2 that is attribute routing. Attribute routing is used to define various attributes routing URL over controller and actions level. Up to mvc4 we learned about convention based routing. To implement attribute routing we have to enable it in routeconfig.cs class. After enabling attribute routing we can define multiple custom routes on controller and actions very easily so guys let’s start and see.
Convention based routing and attribute routing can be used together

How to enable attribute routing


routes.MapMvcAttributeRoutes() method is used to enable attribute routing.

now create a student controller and define following actions into it

Now run program by and write following url in see result



Note : Please specify port number after localhost as per your system

Select your currency