Table of Contents

Interface ICmsSite

Namespace
ToSic.Sxc.Context
Assembly
ToSic.Sxc.dll

The site context of the code - so basically which website / portal it's running on.

🪒 In Dynamic Razor it's found on CmsContext.Site
🪒 In Typed Razor it's found on MyContext.Site

[PublicApi]
public interface ICmsSite : IHasMetadata

Properties

Id

The Id of the site in systems like DNN and Oqtane.

🪒 Use in Dynamic Razor: CmsContext.Site.Id
🪒 Use in Typed Razor: MyContext.Site.Name

int Id { get; }

Property Value

int

Remarks

In DNN this is the same as the PortalId

Metadata

Metadata of the current site

[JsonIgnore]
IMetadata Metadata { get; }

Property Value

IMetadata

Remarks

Added in v13.12

Url

The site url with protocol. Can be variation of any such examples:

🪒 Use in Dynamic Razor: CmsContext.Site.Url
🪒 Use in Typed Razor: MyContext.Site.Url

string Url { get; }

Property Value

string

UrlRoot

The url root which identifies the current site / portal as is. It does not contain a protocol, but can contain subfolders. This is mainly used to clearly identify a site in a multi-site system or a language-variation in a multi-language setup.

🪒 Use in Dynamic Razor: CmsContext.Site.UrlRoot
🪒 Use in Typed Razor: MyContext.Site.UrlRoot

string UrlRoot { get; }

Property Value

string

Remarks

introduced in 2sxc 13