#1 Detect the current platform using CmsContext.Platform
Hybrid Razor - Detect Platform
Razor is mostly HTML
+ C#
.
But we need often need .net features, which can vary a bit from .net Framework and DNN, or .net core and Oqtane.
This is where CmsContext.Platform.Name
is used.
Read more about this in the docs.
Output
You are running "Oqtane"
#1 Detect the current platform using CmsContext.Platform
Source Code of this file
Below you'll see the source code of the file. Note that we're just showing the main part, and hiding some parts of the file which are not relevant for understanding the essentials. Click to expand the code
@inherits Custom.Hybrid.Razor14 <!-- unimportant stuff, hidden --> <div @Sys.PageParts.InfoWrapper()> @Html.Partial("../shared/DefaultInfoSection.cshtml") <div @Sys.PageParts.InfoIntro()> <h2>Hybrid Razor - Detect Platform</h2> <p> Razor is mostly <code>HTML</code> + <code>C#</code>. But we need often need .net features, which can vary a bit from .net Framework and DNN, or .net core and Oqtane. This is where <code>CmsContext.Platform.Name</code> is used. Read more about this in the <a href="https://docs.2sxc.org/net-code/razor/hybrid/index.html" target="_blank">docs</a>. </p> </div> </div> </p> <hr> You are running "@CmsContext.Platform.Name" <!-- unimportant stuff, hidden --> @* Footer *@ @Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })