How To Detect Server Type Setting in CMS via Ektron API

  • Updated

This article demonstrates the Ektron code that can be used to detect the Server Type setting in the CMS>Settings>Setup>General Tab as seen in the image below.

servertype.PNG

 

The code below will retrieve the setting indicated above.

protected void Page_Load(object sender, EventArgs e)
    {
        Ektron.Cms.CommonApi capi = new Ektron.Cms.CommonApi();

        if (!capi.EkSiteRef.RequestInformation.IsStaging)
        {
            Response.Write("This is a production site");
        }
        else
        {
            Response.Write("This is a staging site");
        }
    }