MVC and request handling

Last updated Tuesday, August 30, 2016 in Sitecore Experience Platform for Developer
Keywords: Development

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.ViewExtensions setting, the request is transferred to MVC.
  • If no layout is associated with the current item, but the item has a controller specified in the Controller field, the request is transferred to MVC.

The 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:

reqlifecycle