From the course: Learning ASP.NET Core MVC

Unlock the full course today

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

Customize your application's URLs

Customize your application's URLs

From the course: Learning ASP.NET Core MVC

Start my 1-month free trial

Customize your application's URLs

- [Narrator] Defining a single global route for your entire site as I've shown is a really convenient and effect way to map any URLs in your application to a controller and action. And there are a lot of very successful applications written just this way. Personally however, I don't like to be restricted by a single convention across my entire site. Instead I like to have the ability to attach any custom URL that I want and create vanity URLs such as slash log in, that don't necessarily have anything to do with the name of the controller or the action that handles them. To help demonstrate why we might want to customize our site's URLs, let's take a look at how our default route configuration drives our URLs right now. Keep in mind that our default route currently follows the pattern of slash controller, slash action, slash ID which means that if we want to view a blog post with the ID of one, then we'd have to navigate to slash blog, slash post slash one. However, wouldn't it be nice…

Contents