Routing

Learn about how routing is handled in ASP.NET Core.

What is routing?

Routing is the ability to access different pages within a single domain name. It matches incoming HTTP requests and redirects to the application’s executable endpoints. Endpoints are parts of your code that handle requests and give an appropriate response.

How is it achieved?

Applications can achieve routing by using a handful different of ways. But in this lesson, you will be focusing on controller routing. The name of the controller determines a route. For example, if a controller’s name is UsersController, your route will be /Users. The framework extracts the route from the name of the controller.

A URL of the form Controller1/Method1 maps to a method named Method1 in the Controller1 class. If the name of the Users class method is SignUp(), then the route will be /Users/SignUp/. Controllers are covered in depth in a later lesson.

Example

The following example demonstrates how routes work.

Get hands-on with 1400+ tech skills courses.