When you use MVC, Sitecore transfers request processing to the ASP.NET MVC rendering engine in three situations:
- If the request matches an MVC route, the request is transferred to MVC after the Sitecore context has been set up, but before the Sitecore layout has been resolved.
- After the Sitecore layout has been resolved, its file extension is examined and if it matches one of the extensions specified in the
MvcSettings.ViewExtensionssetting, the request is transferred to MVC.
- If no layout is associated with the current item, but the item has a controller specified in the
Controllerfield, the request is transferred to MVC.
httpRequestBegin pipeline detects these situations, and uses custom processors for the request. If none of these conditions are met, the request is handled as a WebForms request.
The following diagram shows how Sitecore MVC handles requests detail:
Sitecore uses GetControllerRenderer processor pipeline to emit the response after controller execution. This pipeline reads Controller & Action name from controller rendering definition and hands over to ControllerRenderer which intern calls ControllerRunner to execute the controller’s action method and emit the response.