Interface ICmsContext
This is the runtime context of your code in the CMS. It can tell you about the site, page, module etc. that you're on. Note that it it Platform Agnostic so it's the same on Dnn, Oqtane etc.
CMS Context in your Code
All your Razor and WebApi code will have a property CmsContext
which provides you information about the environment you're running in.
Here's a Code Snippet for Razor, showing you what page etc. your code is running on:
ModuleId: @CmsContext.Module.Id
History
- Added in 2sxc 11.11
Namespace: ToSic.Sxc.Context
Assembly: ToSic.Sxc.dll
Syntax
[PublicApi]
public interface ICmsContext
Properties
| Improve this Doc View SourceCulture
Information about languages / culture of the current request
Declaration
ICmsCulture Culture { get; }
Property Value
Type | Description |
---|---|
ICmsCulture |
Module
Information about the Module / Container which holds an 2sxc content block in the CMS
Declaration
ICmsModule Module { get; }
Property Value
Type | Description |
---|---|
ICmsModule |
Page
Information about the Page (called Tab in DNN)
Declaration
ICmsPage Page { get; }
Property Value
Type | Description |
---|---|
ICmsPage |
Platform
Information about the platform that's currently running.
Declaration
ICmsPlatform Platform { get; }
Property Value
Type | Description |
---|---|
ICmsPlatform |
Site
Information about the Site (called Portal in DNN)
Declaration
ICmsSite Site { get; }
Property Value
Type | Description |
---|---|
ICmsSite |
User
Information about the current user
Declaration
ICmsUser User { get; }
Property Value
Type | Description |
---|---|
ICmsUser |
View
Experimental feature for 12.02 - not final. Provides View-information.
Declaration
ICmsView View { get; }
Property Value
Type | Description |
---|---|
ICmsView |
Remarks
New in v12.02, WIP