Try our conversational search powered by Generative AI!

Interface ISiteDefinitionResolver

Component that resolves which SiteDefinition that matches

Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public interface ISiteDefinitionResolver

Methods

GetByContent(ContentReference, Boolean)

Gets the SiteDefinition for a content reference.

Declaration
SiteDefinition GetByContent(ContentReference contentLink, bool fallbackToWildcard)
Parameters
Type Name Description
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.

Returns
Type Description
SiteDefinition

A SiteDefinition instance for the site that contentLink belongs to or null if no site could be matched.

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.

GetByHostname(String, Boolean, out HostDefinition)

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

Declaration
SiteDefinition GetByHostname(string hostname, bool fallbackToWildcard, out HostDefinition matchedHost)
Parameters
Type Name Description
System.String hostname

Name of the host.

System.Boolean fallbackToWildcard

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

HostDefinition matchedHost

The HostDefinition on the site definition that matched the provided host name.

Returns
Type Description
SiteDefinition

The SiteDefinition that matches host or null if no matches

Extension Methods

EPiServer.Web.SiteDefinitionResolverExtensions.GetByHostname(EPiServer.Web.ISiteDefinitionResolver, System.String, System.Boolean)
EPiServer.Web.SiteDefinitionResolverExtensions.GetByContent(EPiServer.Web.ISiteDefinitionResolver, EPiServer.Core.ContentReference, System.Boolean, System.Boolean)