Umbraco's request pipeline is the process of building up a URL, resolving the requests, and returning correct content.
The inbound process is triggered by UmbracoRouteValueTransformer
and then handled with the Published router. The Published Content Request Preparation process kicks in and creates a PublishedRequestBuilder
which will be used to create a PublishedContentRequest
.
What it does:
It ensures Umbraco is ready, and the request is a document request.
Ensures there's content in the published cache, if there isn't it routes to the RenderNoContentController
which displays the no content page you see when running a fresh install.
Creates a published request builder.
Routes the request with the request builder using the PublishedRouter.RouteRequestAsync(…)
.
This will handle redirects, find domain, template, published content and so on.
Build the final IPublishedRequest
.
Sets the routed request in the Umbraco context, so it will be available to the controller.
Create the route values with the UmbracoRouteValuesFactory
.
This is what routes your request to the correct controller and action, and allows you to hijack routes.
Set the route values to the http context.
Handles posted form data.
Returns the route values to netcore so it routes your request correctly.
When finding published content the PublishedRouter will first check if the PublishedRequestBuilder already has content, if it doesn't the content finders will kick in. For more information, see the Find published content section in the Published Content Request Preparation article.
This information is also used during the Controller & Action selection process.
During the Umbraco request execution, an MVC Action is called which executes a Razor view to render content to the end-user,
Whenever a content item is rendered on the front-end, it is based on a model of type IPublishedContent
. This model contains all of the information about the content item associated with the current request.
If you are working in a custom MVC Controller's action, a model of type ContentModel
will be provided in the Action's method parameters. This model contains an instance of IPublishedContent
which you can use.
When you are working in a View of type UmbracoViewPage
(which is the default view type), the Model provided to that view will be IPublishedContent
. For example, to render the current content model's name you could do:
All Umbraco view page types inherit from UmbracoViewPage<TModel>
. A neat trick is that if you want your view Model to be IPublishedContent
you can change your view type to UmbracoViewPage
. After changin the type the view will still render without issue even though the controller is passing it a model of type ContentModel.
IPublishedContent is a strongly typed model used for all published content, media, and members. It is used to render content in your views for your website.
UmbracoHelper is the unified way to work with published content/media on your website. Whether you are using MVC or WebForms you will be able to use UmbracoHelper to query/traverse Umbraco published data.
IMemberManager is an user manager interface for accessing member data in the form of IPublishedContent. IMemberManager has a variety of methods that are useful in views, controllers, and webforms classes.
Get an overview of how the Umbraco pipeline is structured. See what happens from user request to content delivery.
Matching a URL to a content item & determining the rendering engine (MVC or Webforms).
Match an MVC Controller and Action to handle the request.
The MVC Action and View are executed. During this execution you can query for published data to be displayed/rendered.
IPublishedContent is a strongly typed underlying model used in all Umbraco views.
Use UmbracoHelper to query published media and content.
This section covers the IMemberManager.
When you make a page request to the MVC application, a controller is responsible for returning the response to that request. The controller can perform one or more actions. The controller action can return different types of action results based on the request.
By default, Umbraco will execute every request via it's built-in default controller: Umbraco.Cms.Web.Common.Controllers.RenderController
. Umbraco site automatically routes all the front-end requests via the Index
action of the RenderController
.
It is possible to implement a custom Controller to replace the default implementation to give complete control during the Umbraco request pipeline execution. You can configure Umbraco to use your implementation in a class with a composer. For example:
Ensure that the controller inherits from the base controller Umbraco.Cms.Web.Common.Controllers.RenderController
. You can override the Index
method to perform any customizations of your choice.
You can create Custom controllers for different Document Types and Templates. This is termed 'Hijacking Umbraco Routes'. For details on how this process works, see the Custom MVC Controllers (Umbraco Route Hijacking) article.