Environment configurations with episerver cms 11.20.12 not working as expected



We added code from this document https://world.optimizely.com/documentation/developer-guides/archive/dxp-cloud-services/development-considerations/environment-configurations/ to know the environment during runtime and act according but that's not working as expected. Just to test if we change the environment name from Azure App Service it's not working as expected.

private static bool GetAzureEnvironmentConfiguration()


            var appSettings = ConfigurationManager.AppSettings;

            var environmentName = appSettings["episerver:EnvironmentName"];

            bool isIntegrationOrPreproduction = false;

            if (environmentName == null || environmentName.Equals("Integration") || environmentName.Equals("Preproduction"))


                isIntegrationOrPreproduction = true;


            return isIntegrationOrPreproduction;


This means code can't integrate with Azure app service during run time? Can anybody help with this issue.



Aug 10, 2022 6:32

Did you add the episerver:EnvironmentName keys to each of your Integration, Preproduction and Production web configs?

Aug 11, 2022 1:29

Yes we have it for all the three environments.

Aug 11, 2022 4:25

DId you try to debug to see which value environmentName has? Perhaps it's case sensitivity issue? 

Aug 11, 2022 9:43
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.