Table of Contents

Class UmbracoPageController

Namespace
Umbraco.Cms.Web.Common.Controllers
Assembly
Umbraco.Web.Common.dll

An abstract controller for a front-end Umbraco page

public abstract class UmbracoPageController : UmbracoController, IActionFilter, IAsyncActionFilter, IFilterMetadata, IDisposable
Inheritance
UmbracoPageController
Implements
Derived
Inherited Members
Extension Methods

Constructors

UmbracoPageController(ILogger<UmbracoPageController>, ICompositeViewEngine)

Initializes a new instance of the UmbracoPageController class.

protected UmbracoPageController(ILogger<UmbracoPageController> logger, ICompositeViewEngine compositeViewEngine)

Parameters

logger ILogger<UmbracoPageController>
compositeViewEngine ICompositeViewEngine

Properties

CurrentPage

Gets the current content item.

protected virtual IPublishedContent? CurrentPage { get; }

Property Value

IPublishedContent

UmbracoRouteValues

protected virtual UmbracoRouteValues UmbracoRouteValues { get; }

Property Value

UmbracoRouteValues

Methods

CurrentTemplate<T>(T)

Gets an action result based on the template name found in the route values and a model.

protected virtual IActionResult CurrentTemplate<T>(T model)

Parameters

model T

The model.

Returns

IActionResult

The action result.

Type Parameters

T

The type of the model.

Exceptions

InvalidOperationException

If the template found in the route values doesn't physically exist and exception is thrown

EnsurePhsyicalViewExists(string?)

Ensures that a physical view file exists on disk.

protected bool EnsurePhsyicalViewExists(string? template)

Parameters

template string

The view name.

Returns

bool