The MVC Pattern and Request Life Cycle
|
This section documents ASP.NET MVC 5.3.x, ASP.NET Web API 2.2, ASP.NET Web Pages 3, OWIN/Katana, SignalR 2,
and ASP.NET Identity 2 — all running on .NET Framework 4.8.1 — the This is not ASP.NET Core MVC. ASP.NET MVC 5 is the pre-Core, This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. This section’s bibliography lists the reference material consulted while preparing these pages. |
This page documents ASP.NET MVC 5.3.x on .NET Framework 4.8.1 — not ASP.NET Core MVC. It traces one request end to end and explains where each extensibility point sits.
Model, View, Controller as applied here
-
Model — plain C# classes (POCOs), commonly EF6 entities or dedicated view models — see Data Access with EF6. MVC imposes no base class on a model.
-
View — a
.cshtmlRazor template that renders a model to HTML (or another format). See Razor Syntax. -
Controller — a class deriving from
System.Web.Mvc.Controller, grouping related action methods that handle requests, manipulate the model, and choose a view. See Controllers and Actions.
Unlike Web Forms, where a page’s markup and code-behind are tightly coupled to a Control tree and view state,
MVC deliberately separates these three concerns so each can be tested and replaced independently — this is the
central architectural difference covered in the table below.
The request pipeline, step by step
-
UrlRoutingModule— anIHttpModuleregistered inweb.configthat hooksPostResolveRequestCacheand matches the incoming URL againstRouteTable.Routes(populated byRouteConfig.RegisterRoutes; see Routing and Areas). A match producesRouteDatacarrying the route’sIRouteHandler. -
MvcRouteHandler— theIRouteHandlerthat everyMapRoutecall implicitly wires up; itsGetHttpHandlerreturns anMvcHandlerfor the matchedRequestContext. -
MvcHandler— theIHttpHandler(async, viaIHttpAsyncHandler) that is MVC’s actual entry point in theSystem.Webpipeline. It resolves anIControllerFactory(ControllerBuilder.Current.GetControllerFactory) and asks it to create the controller named in the route. -
IControllerFactory—DefaultControllerFactorylocates aController-derived type by naming convention ({name}Controller) and instantiates it, optionally throughIControllerActivatorso a DI container can supply constructor dependencies. -
IActionInvoker—ControllerActionInvoker(viaController.ActionInvoker) selects the action method using action selectors, binds its parameters via model binding (see Model Binding and Validation), and runs the filter pipeline around the call (see Filters). -
The action returns an
ActionResult;ActionResult.ExecuteResultis then called with the currentControllerContext. ForViewResultthis locates and renders a view through the view engine (RazorViewEngine, resolved via theViewEngines.Enginescollection — see Views, Layouts, and Partials).
See Lifecycle
of an ASP.NET MVC 5 Application and
ASP.NET Application Life Cycle
Overview for IIS 7.0 for the underlying System.Web request pipeline that hosts all of this.
Extensibility at each step
| Step | Substitute by |
|---|---|
Route matching |
A custom |
|
A custom |
|
|
|
|
|
Any custom |
|
|
MVC vs. Web Forms
| ASP.NET MVC 5 | ASP.NET Web Forms | |
|---|---|---|
Request entry point |
|
A |
UI unit |
Action method returning an |
A |
State model |
Stateless per request; explicit |
|
Markup |
Razor |
|
Testability |
Controllers/actions unit-testable in isolation |
Requires the ASP.NET runtime or heavy mocking |
HTML control |
Full — you own every tag |
Partial — server controls render their own markup |
Next: Controllers and Actions covers what happens inside step 5-6 above in detail.