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");
}
}