From the course: ASP.NET MVC: Building for Productivity and Maintainability

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Customizing routes with attribute routing

Customizing routes with attribute routing

From the course: ASP.NET MVC: Building for Productivity and Maintainability

Start my 1-month free trial

Customizing routes with attribute routing

- [Instructor] If you're like me and consider the structure and content of your url's to be very important, then you'll love this feature. Frankly, I've never been quite happy with the ad route API that the ASPNET Mvc project template gives you out of the box. You know, the one that you'll find in the route config class in the app start folder of any new ASPNET Mvc application. Like most of the things we'll be improving upon in this course, this default route behavior provides a really reasonable convention and it's a great starting point to build on, but what about when you want to create, let's say, an about us page and you want it's URL to be simply /about. You could accomplish that by making a copy of the map route method call and customizing it so that it maps the hard-coded about URL to the about action in the home controller like this, (typing) and this would work perfectly fine but as the list of custom url's in your application grows, so does this file until it eventually…

Contents