ASP. NET route

Source: Internet
Author: User
ArticleDirectory
  • 1. Basic Structure of the route module.
  • 2. Find the appropriate route to parse the current URL

This article mainly describes the basic working principle of ASP. NET route components. The route component was originally a part of MVC, but was later independent.ProgramAs the route component is the basic component of ASP. NET, how does the route component forward the request to MVC when a request arrives? Yesterday I downloaded ASP. NET MVC2Source codeI was always cheated by maproute. this method is not a built-in method of the route component, but an extension method provided by the MVC module. in this extension method, it explicitly specifies routehandler as mvcroutehander. why is the extension method of MVC not called mapmvcroute? Return to the route component itself. In fact, the route component itself is a very simple module. It mainly provides the following two functions:

  • Find the appropriate route to parse the URL of the current request.
  • Find the appropriate route to generate the URL.
1. Basic Structure of the route module.

Shows the basic structure of the route module:

In the figure above, routetable, routecollection, routebase, routedata, and iroutehandler are the core components of the route module. route is a reference implementation of routebase. the style of Microsoft's work is to provide an abstract architecture while providing a good enough reference for implementation. if you need to expand the abstract architecture on a large scale, you must distinguish them. ihttphandler is ASP. NET platform basic interface.

2. Find the appropriate route to parse the current URL

To be continued...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.