1. IIS
- IIS route HTTP request to the right web application (website or virtual directory).
- Web application invoke the ASP.Net module if the url type is registed with ASP.Net
- ASP.Net receives the request, invoke all the HTTP module in sequence to process the request
2. Core Routing
- HTTP Module UrlRoutingModule invoke System.Web.Routing to route the request.
- If the URL is mapped to a static file on disk (e.g. .jpg .css .js), core routing bails out, leaving IIS to handle that request natively. ASP.NET Web Forms .aspx pages will be executed in the normal way (page life cycle)
- If the incoming URL doesn’t correspond to a file on disk (e.g., requests for MVC controllers, which are .NET types), core routing will try to find the matching route handler based on the active Routing Configurations (System.Web.Routing.RouteTable.Routes entries, search from top to bottom)
3: Controllers and Actions
- If core routing find the controller, it parse the request parameters from URL and prepare the request data package, and create controller instance by MvcRouteHandler using a controller factory object.
- The action method in the controller is invoked based on the URL pattern.
- Action method will return a ActionResult, which can be ViewResult (render HTML page), RedirectToRouteResult (redirect to another URL) or others.
- Filters may be applied to inject extra logic that runs before or after action methods, or before or after action results are executed.