Class RazorPageExtensions

Version: 21.x

Extensions to support Razor pages and views.

Inheritance

System.Object

RazorPageExtensions

Namespace: Sitecore.AspNet.RenderingEngine.Extensions

Assembly: Sitecore.AspNet.RenderingEngine.dll

Syntax
public static class RazorPageExtensions : Object

Methods

SitecoreComponent(IRazorPage)

Gets the current Sitecore Component.

Declaration
public static Component SitecoreComponent(this IRazorPage page)
Parameters
TypeNameDescription
Microsoft.AspNetCore.Mvc.Razor.IRazorPagepageThe current Microsoft.AspNetCore.Mvc.Razor.IRazorPage.
Returns
TypeDescription
ComponentThe current instance of Component.

SitecoreContext(IRazorPage)

Gets the current Sitecore Context.

Declaration
public static Context SitecoreContext(this IRazorPage page)
Parameters
TypeNameDescription
Microsoft.AspNetCore.Mvc.Razor.IRazorPagepageThe current Microsoft.AspNetCore.Mvc.Razor.IRazorPage.
Returns
TypeDescription
ContextThe current instance of Context.

SitecoreRoute(IRazorPage)

Gets the current Sitecore Route data.

Declaration
public static Route SitecoreRoute(this IRazorPage page)
Parameters
TypeNameDescription
Microsoft.AspNetCore.Mvc.Razor.IRazorPagepageThe current Microsoft.AspNetCore.Mvc.Razor.IRazorPage.
Returns
TypeDescription
RouteThe current instance of Route.
If you have suggestions for improving this article, let us know!