Jonathan Sayce
Jonathan Sayce

Reputation: 9659

Source of Settings Accessed with WebConfigurationManager

When an ASP.NET MVC application is running as an Azure Web App, the WebConfigurationManager can pick up settings from both the Azure Portal Application Settings and from the web.config file, with the portal settings taking precedence.

Is there any way to check whether a particular setting has come from the portal or the web.config?

Upvotes: 0

Views: 131

Answers (1)

David Ebbo
David Ebbo

Reputation: 43183

There is no clean way to tell. But if you're ok with a dirty/undocumented way (not guaranteed to work forever), try this:

To check if FOO comes from Azure, check for the presence of an environment variable named APPSETTING_FOO.

Upvotes: 2

Related Questions