UmbracoCms.Core by Umbraco HQ

<PackageReference Include="UmbracoCms.Core" Version="7.13.3" />

.NET API 7,886,672 bytes

 UmbracoContext

Class that encapsulates Umbraco information of a specific HTTP request
public static UmbracoContext Current { get; }

Gets the current Umbraco Context.

Gets the current ApplicationContext

Gets or sets the published content cache.

public HttpContextBase HttpContext { get; }

Exposes the HttpContext for the current request

public bool InPreviewMode { get; set; }

Determines whether the current user is in a preview mode and browsing the site (ie. not in the admin UI)

public bool IsDebug { get; }

Gets a value indicating whether the request has debugging enabled

public bool IsFrontEndUmbracoRequest { get; }

Boolean value indicating whether the current request is a front-end umbraco request

Gets or sets the published media cache.

public int? PageId { get; }

Gets the current page ID, or null if no page ID is available (e.g. a custom page).

Gets/sets the PublishedContentRequest object

Gets/sets the RoutingContext object

public WebSecurity Security { get; }

Gets the WebSecurity class

public User UmbracoUser { get; }

Gets the current logged in Umbraco user (editor).

public UrlProvider UrlProvider { get; }

A shortcut to the UmbracoContext's RoutingContext's NiceUrlProvider

public static UmbracoContext CreateContext(HttpContextBase httpContext, ApplicationContext applicationContext, WebSecurity webSecurity, IUmbracoSettingsSection umbracoSettings, IEnumerable<IUrlProvider> urlProviders, bool? preview)

Creates a standalone UmbracoContext instance

public static UmbracoContext EnsureContext(HttpContextBase httpContext, ApplicationContext applicationContext, WebSecurity webSecurity)

public static UmbracoContext EnsureContext(HttpContextBase httpContext, ApplicationContext applicationContext)

public static UmbracoContext EnsureContext(HttpContextBase httpContext, ApplicationContext applicationContext, bool replaceContext)

public static UmbracoContext EnsureContext(HttpContextBase httpContext, ApplicationContext applicationContext, WebSecurity webSecurity, bool replaceContext)

public static UmbracoContext EnsureContext(HttpContextBase httpContext, ApplicationContext applicationContext, WebSecurity webSecurity, bool replaceContext, bool? preview)

public static UmbracoContext EnsureContext(HttpContextBase httpContext, ApplicationContext applicationContext, WebSecurity webSecurity, IUmbracoSettingsSection umbracoSettings, IEnumerable<IUrlProvider> urlProviders, bool replaceContext, bool? preview = default)

This is a helper method which is called to ensure that the singleton context is created