Class UmbracoPageController
An abstract controller for a front-end Umbraco page
Namespace: Umbraco.Cms.Web.Common.Controllers
Assembly: Umbraco.Web.Common.dll
Syntax
public abstract class UmbracoPageController : UmbracoController
Constructors
View SourceUmbracoPageController(ILogger<UmbracoPageController>, ICompositeViewEngine)
Initializes a new instance of the UmbracoPageController class.
Declaration
protected UmbracoPageController(ILogger<UmbracoPageController> logger, ICompositeViewEngine compositeViewEngine)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger<UmbracoPageController> | logger | |
| ICompositeViewEngine | compositeViewEngine |
Properties
View SourceCurrentPage
Gets the current content item.
Declaration
protected virtual IPublishedContent? CurrentPage { get; }
Property Value
| Type | Description |
|---|---|
| IPublishedContent |
UmbracoRouteValues
Gets the UmbracoRouteValues
Declaration
protected virtual UmbracoRouteValues UmbracoRouteValues { get; }
Property Value
| Type | Description |
|---|---|
| UmbracoRouteValues |
Methods
View SourceCurrentTemplate<T>(T)
Gets an action result based on the template name found in the route values and a model.
Declaration
protected virtual IActionResult CurrentTemplate<T>(T model)
Parameters
| Type | Name | Description |
|---|---|---|
| T | model | The model. |
Returns
| Type | Description |
|---|---|
| IActionResult | The action result. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the model. |
Exceptions
| Type | Condition |
|---|---|
| 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.
Declaration
[Obsolete("Please use the correctly spelt EnsurePhysicalViewExists method. Scheduled for removal in Umbraco 18.")]
protected bool EnsurePhsyicalViewExists(string? template)
Parameters
| Type | Name | Description |
|---|---|---|
| string | template | The view name. |
Returns
| Type | Description |
|---|---|
| bool |
EnsurePhysicalViewExists(string?)
Ensures that a physical view file exists on disk.
Declaration
protected bool EnsurePhysicalViewExists(string? template)
Parameters
| Type | Name | Description |
|---|---|---|
| string | template | The view name. |
Returns
| Type | Description |
|---|---|
| bool |