From the course: Learning ASP.NET Core MVC
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Customize your application's URLs
From the course: Learning ASP.NET Core MVC
Customize your application's URLs
- [Instructor] Now that you know what the ASP.NET Core MVC framework is, it's time to add it to our application. Like most other ASP.NET Core features, adding the MVC feature begins with registering it with the appropriate middleware. In this case, this is done with a call to app.UseMvc. In this function, you can define the route patterns that the ASP.NET Core MVC middleware should be listening to. It looks like this. I'll explain the details of what's going here in a later video. But all you really need to know right now is that this string represents the URL to be matched and each of these placeholders defines a section of the URL and gives it a name. For example, if I navigated to /admin/user/1 that would map to the admin controller, the user's action on the controller and the ID of one. Now, this call is a crucial part of configuring ASP.NET Core MVC but it's only half of what is required to demonstrate. Let me run the site and show you what happens. This site is throwing an error…
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.