Home  >  Article  >  Backend Development  >  Detailed introduction to MVC routing

Detailed introduction to MVC routing

零下一度
零下一度Original
2017-06-11 13:02:451639browse

This article mainly introduces the configuration of using the default MVC routing in ASP.NET Core. The editor thinks it is quite good, so I will share it with you now and give it as a reference. Let's follow the editor and take a look. There are not many changes to the Route in ASP.NET Core. There are just some adjustments in usage and some more concise syntax is provided. Of course, there is no problem with supporting custom routing. This function should have been available since the MVC1.0 version. Let’s first look at the configuration method to implement the default MVC routing in ASP.NET Core. Normally, when using an MVC project, the default routing is enough, which is the common way to obtain specific methods through Controller and Action. Start with a basic project and perform the following steps to make the project support MVC routing 1. Create a blank ASP.NET Core (Empty) Web project 2. Open project.json and add the following dependencies under the "dependencies" node Project "Microsoft.AspNetCore.

1. Configuration for using MVC routing in Core

Detailed introduction to MVC routing

Introduction: This article mainly introduces the configuration of using the default MVC routing in ASP.NET Core. The editor thinks it is quite good. I will share it with you now and give it a reference. Let’s compile it and take a look

2. The most complete ASP.NET MVC routing configuration in history

Detailed introduction to MVC routing

Introduction: First, let’s talk about the basic routing rule principles. The basic routing rules are arranged from special to general, that is, the most special (non-mainstream) rules are at the top and the most general. (Taiwan Balm) rules are listed last. This is because the matching routing rules are also in this order. If you write them wrong, you will still wait for 404. XD Let’s talk about the structure of the URL first. It’s not about structure, just syntax features.

##3. ASP.NET MVC routing configuration (detailed graphic and text explanation)

Detailed introduction to MVC routing

Introduction: First, let’s talk about the basic routing rules principles. The basic routing rules are arranged from special to general, which are the most special (non-mainstream) rules. At the front, the most general (one-size-fits-all) rules are listed last. This is because the matching routing rules are also in this order. If you write them in reverse order, even if you write the routing rules correctly, you will still wait for 404.XD. The structure. In fact, this is not a structure, it is just a grammatical feature

The above is the detailed content of Detailed introduction to MVC routing. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn