Chapter 14. Advanced Routing

The first chapter of this book gave you a brief introduction to the fundamentals of ASP.NET MVC routing. That chapter shows the default route that Visual Studio generates for you when you create a new ASP.NET MVC project, and it talks about how the routing framework uses that route to determine which controller and action should be used to execute each request.

For the most part, you will not need to worry about anything more advanced than the default route that Visual Studio initially generates. The default route follows the standard ASP.NET MVC convention and allows you to create new controllers and actions without having to worry much about how the routing engine will locate them. Only if your application moves beyond these common scenarios will you have to gain a better understanding of ASP.NET MVC’s powerful routing framework in order to operate outside of the default URL pattern and the default values.

In this chapter, we will go beyond ASP.NET MVC’s conventional route and take a deeper look at the powerful routing engine that drives ASP.NET MVC applications. We’ll start with a discussion about why URLs are so important to a web application’s user experience and how your application’s URLs can affect how your site ranks in search engine results. Then we’ll dive into creating more advanced routes by exploring different URL patterns. We’ll also consider defining constraints on those routes and look at a useful tool, called Glimps, for helping to debug ...

Get Programming ASP.NET MVC 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.