. Net Mvc framework principle,. netmvc framework

Source: Internet
Author: User

. Net Mvc framework principle,. netmvc framework

. Net Mvc framework principle

This article briefly describes the principles and summarizes them.

1. When an Http request is sent, it will be intercepted by the URLRoutingModule (this is to officially enter the MPs queue, and the following chapter will talk about MPs queue events)

2. Based on the IsapiWorkerRequest object, HttpRuntime will create a Context equivalent to the Http request: HttpContext

3. encapsulate HttpContext and change it to the HttpContextWarpper object. Then, locate the RouteData object that meets the current request URL from the Route set, and encapsulate the HttpContext and RouteData objects into RequestContext objects.

4. Obtain IHttpHandler Based on RouteHandler in the RouteData object. MvcHandler is an implementation class of IHttpHandler.

5. Execute IHttpHandler, execute a specific Controller through reflection, and execute a specific Action

UrlRoutingMudule and MVCHandler

UrlRoutingMudule inherits IHttpMudule, MVCHandler inherits IHttpHandler, HttpMudule and HttpHandler are both objects in HttpApplication, and HttpMudule is the objects loaded and initialized according to the configuration file during HttpApplication initialization, it is mainly responsible for injecting the required operations into the processing process of the entire HTTP request by registering the corresponding events of HttpApplication. Many functions of ASP. NET, such as identity authentication, authorization, and caching, are implemented through the corresponding HttpModule. The final implementation of HTTP request processing is another important object: HttpHandler. Different resource types have different HttpHandler types. For example, the HttpHandler corresponding to the. aspx Page is System. Web. UI. Page, and the HttpHandler corresponding to the. svc file of WCF is System. ServiceModel. Activation. HttpHandler.

This article focuses on learning from the MVC series-MVC source code: Creating Your Own MVC Framework (great explanation)

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.