From the course: Learning ASP.NET Core MVC
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Understand routing
From the course: Learning ASP.NET Core MVC
Understand routing
- [Narrator] Earlier in the course, I introduced you to the basic concepts of routing by showing how a URL maps to an action method on a controller class and even how to extract action method parameters from values in the URL. If you thought that was powerful, that's just the beginning of what routing can do. I mentioned previously that all of this routing magic is defined in the call to add MVC to register the ASP.NET Core MVC middle ware in the start up class in the form of a route template. A pattern that maps URLs to controllers and actions using named placeholders. You can register as many routes as you want but it's this one route template that is generic enough to map a URL to just about any controller and action that I can create. Once it maps those parts of the URL to those placeholders, it tries to find the controller and action that match those placeholders. This is where the name of the controller class becomes significant. By default, ASP.NET Core MVC follows the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.