SaaS CMS has officially launched! Learn more now.

Class SiteDefinitionResolverExtensions

Extends ISiteDefinitionResolver with convenient methods

Inheritance
System.Object
SiteDefinitionResolverExtensions
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
Assembly: EPiServer.dll
Version: 10.10.4
Syntax
public static class SiteDefinitionResolverExtensions

Methods

Get(ISiteDefinitionResolver, HttpRequestBase)

Gets the SiteDefinition that has a host that matches specified request.

Declaration
public static SiteDefinition Get(this ISiteDefinitionResolver siteDefinitionResolver, HttpRequestBase request)
Parameters
Type Name Description
ISiteDefinitionResolver siteDefinitionResolver

The site definition resolver that is being extended

System.Web.HttpRequestBase request

The request.

Returns
Type Description
SiteDefinition

GetByContent(ISiteDefinitionResolver, ContentReference, Boolean, Boolean)

Gets the SiteDefinition for a content reference.

Declaration
public static SiteDefinition GetByContent(this ISiteDefinitionResolver siteDefinitionResolver, ContentReference contentLink, bool fallbackToWildcard, bool fallbackToEmpty)
Parameters
Type Name Description
ISiteDefinitionResolver siteDefinitionResolver

The site definition resolver that is being extended

ContentReference contentLink

The content link.

System.Boolean fallbackToWildcard

if set to true and if content link is not under any site, use SiteDefinition mapped with Wildcard.

System.Boolean fallbackToEmpty

if set to true and if content link is not under any site, and not fallback to Wildcard use system default (StartPage and SiteUrl is not defined).

Returns
Type Description
SiteDefinition

A SiteDefinition instance for the site that contentLink belongs to.

Remarks

This is done by traversing the page tree upwards from current link until a Page that matches a StartPage for a registered SiteDefinition.

If the contentLink is not located beneath a start page, the search will fall back to the SiteDefinition instance for the site mapped with * as host fallbackToWildcard is set to True. If the contentLink is not located beneath a start page, and if not fallen back to wildcard and fallbackToEmpty is set to true then the system default setting will be returned which has for example RootPage set but not site specific settings like StartPage and SiteUrl.

GetByHostname(ISiteDefinitionResolver, String, Boolean)

Gets the SiteDefinition that has a host that matches specified hostname.

Declaration
public static SiteDefinition GetByHostname(this ISiteDefinitionResolver siteDefinitionResolver, string hostname, bool fallbackToWildcard)
Parameters
Type Name Description
ISiteDefinitionResolver siteDefinitionResolver

The site definition resolver that is being extended

System.String hostname

Name of the host.

System.Boolean fallbackToWildcard

if set to true then site matched with wildcard (if any) is returned

Returns
Type Description
SiteDefinition