SaaS CMS has officially launched! Learn more now.

Class ContentRouteHelper

The ContentRouteHelper class provides information about the requrested content of the current web request.

Inheritance
System.Object
ContentRouteHelper
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web.Routing
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
[ServiceConfiguration(ServiceType = typeof(ContentRouteHelper), Lifecycle = ServiceInstanceScope.Hybrid)]
public class ContentRouteHelper

Constructors

ContentRouteHelper(RequestContext, RouteCollection, ViewContentRetriever, IContentLoader)

Initializes a new instance of the ContentRouteHelper class.

Declaration
public ContentRouteHelper(RequestContext context, RouteCollection routes, ViewContentRetriever viewContentRetriever, IContentLoader contentLoader)
Parameters
Type Name Description
System.Web.Routing.RequestContext context

The context.

System.Web.Routing.RouteCollection routes

The routes.

ViewContentRetriever viewContentRetriever

The view content retriever.

IContentLoader contentLoader

The content loader

Properties

Content

Gets the content.

Declaration
public virtual IContent Content { get; }
Property Value
Type Description
IContent

Gets the content link.

Declaration
public virtual ContentReference ContentLink { get; }
Property Value
Type Description
ContentReference

ContentLoader

Get the Content Loader

Declaration
protected IContentLoader ContentLoader { get; }
Property Value
Type Description
IContentLoader

LanguageID

Gets the language string for the current page.

Declaration
public virtual string LanguageID { get; }
Property Value
Type Description
System.String
Remarks

The property will be set the first time it gets called, and cached for the current instance.

Examples

The following code example demonstrates how to get information about the requested CMS page for the current web request.

RequestContext

Gets information about an HTTP request that matches the defined route.

Declaration
protected RequestContext RequestContext { get; }
Property Value
Type Description
System.Web.Routing.RequestContext

ViewContentRetriever

Gets the view content retriever.

Declaration
protected ViewContentRetriever ViewContentRetriever { get; }
Property Value
Type Description
ViewContentRetriever

Methods

SetRouteDataIfPageNotRouted()

Sets the route data if page not routed yet.

Declaration
protected virtual void SetRouteDataIfPageNotRouted()

Extension Methods