Chapter 9. Controlling URLs with routing
This chapter covers
So far in this book, we’ve used the default routing configuration that comes with any new ASP.NET MVC project. In this chapter, we’ll cover the routing system in depth and learn how to create custom routes for applications to ensure that URLs are both user-friendly and accessible to search engines.
Routing is all about the URL and how you use it as an external input to the applications you build. When working with other web development tools, such as PHP, Web Forms, or even Classic ASP, the URL typically corresponds to a physical file on disk. A URL of http://example.com/Products.aspx would cause the execution of a file named Products.aspx that would be responsible for handling the request.
ASP.NET MVC decouples the URL from a physical file by making use of URL routing to provide a way to map URLs without extensions to controller actions in a way that gives the developer complete control over the URL schema.