Class UmbracoContext
Class that encapsulates Umbraco information of a specific HTTP request
Namespace: Umbraco.Web
Assembly: Umbraco.Web.dll
Syntax
public class UmbracoContext : DisposableObjectSlim, IDisposeOnRequestEnd, IDisposable
Properties
View SourceContent
Gets the published content cache.
Declaration
public IPublishedContentCache Content { get; }
Property Value
Type | Description |
---|---|
IPublishedContentCache |
ContentCache
Gets the published content cache.
Declaration
[Obsolete("Use the Content property.")]
public IPublishedContentCache ContentCache { get; }
Property Value
Type | Description |
---|---|
IPublishedContentCache |
Domains
Gets the domains cache.
Declaration
public IDomainCache Domains { get; }
Property Value
Type | Description |
---|---|
IDomainCache |
HttpContext
Exposes the HttpContext for the current request
Declaration
public HttpContextBase HttpContext { get; }
Property Value
Type | Description |
---|---|
System.Web.HttpContextBase |
InPreviewMode
Determines whether the current user is in a preview mode and browsing the site (ie. not in the admin UI)
Declaration
public bool InPreviewMode { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsDebug
Gets a value indicating whether the request has debugging enabled
Declaration
public bool IsDebug { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsFrontEndUmbracoRequest
Boolean value indicating whether the current request is a front-end umbraco request
Declaration
public bool IsFrontEndUmbracoRequest { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Media
Gets the published media cache.
Declaration
public IPublishedMediaCache Media { get; }
Property Value
Type | Description |
---|---|
IPublishedMediaCache |
MediaCache
Gets the published media cache.
Declaration
[Obsolete("Use the Media property.")]
public IPublishedMediaCache MediaCache { get; }
Property Value
Type | Description |
---|---|
IPublishedMediaCache |
PublishedRequest
Gets/sets the PublishedRequest object
Declaration
public PublishedRequest PublishedRequest { get; set; }
Property Value
Type | Description |
---|---|
PublishedRequest |
PublishedSnapshot
Gets the published snapshot.
Declaration
public IPublishedSnapshot PublishedSnapshot { get; }
Property Value
Type | Description |
---|---|
IPublishedSnapshot |
Security
Gets the WebSecurity class
Declaration
public WebSecurity Security { get; }
Property Value
Type | Description |
---|---|
WebSecurity |
UrlProvider
Gets the URL provider.
Declaration
public UrlProvider UrlProvider { get; }
Property Value
Type | Description |
---|---|
UrlProvider |
VariationContextAccessor
Gets the variation context accessor.
Declaration
public IVariationContextAccessor VariationContextAccessor { get; }
Property Value
Type | Description |
---|---|
IVariationContextAccessor |
Methods
View SourceDisposeResources()
Declaration
protected override void DisposeResources()
Url(Guid, String)
Gets the URL of a content identified by its identifier.
Declaration
public string Url(Guid contentId, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | contentId | The content identifier. |
System.String | culture |
Returns
Type | Description |
---|---|
System.String | The URL for the content. |
Url(Guid, UrlMode, String)
Gets the URL of a content identified by its identifier, in a specified mode.
Declaration
public string Url(Guid contentId, UrlMode mode, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | contentId | The content identifier. |
UrlMode | mode | The mode. |
System.String | culture |
Returns
Type | Description |
---|---|
System.String | The URL for the content. |
Url(Int32, String)
Gets the URL of a content identified by its identifier.
Declaration
public string Url(int contentId, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | contentId | The content identifier. |
System.String | culture |
Returns
Type | Description |
---|---|
System.String | The URL for the content. |
Url(Int32, UrlMode, String)
Gets the URL of a content identified by its identifier, in a specified mode.
Declaration
public string Url(int contentId, UrlMode mode, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | contentId | The content identifier. |
UrlMode | mode | The mode. |
System.String | culture |
Returns
Type | Description |
---|---|
System.String | The URL for the content. |
UrlAbsolute(Guid, String)
Gets the absolute URL of a content identified by its identifier.
Declaration
[Obsolete("Use the Url() method with UrlMode.Absolute.")]
public string UrlAbsolute(Guid contentId, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | contentId | The content identifier. |
System.String | culture |
Returns
Type | Description |
---|---|
System.String | The absolute URL for the content. |
UrlAbsolute(Int32, String)
Gets the absolute URL of a content identified by its identifier.
Declaration
[Obsolete("Use the Url() method with UrlMode.Absolute.")]
public string UrlAbsolute(int contentId, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | contentId | The content identifier. |
System.String | culture |
Returns
Type | Description |
---|---|
System.String | The absolute URL for the content. |