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.
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();
Response.Write("This is a production site");
Response.Write("This is a staging site");