3

Is it possible to access for global application settings(defined on IIS Home screen -> Application Settings). I believe that global web.config should inherited by all applications, but I have tried

var myGlobalSetting = ConfigurationManager.AppSettings["MyGlobalSetting"]

and

var appSettings = (NameValueCollection)HttpContext.Current.GetSection("appSettings");
var myGlobalSetting = appSettings["MyGlobalSetting"];

Both return null. I don't have anything that override or clear settings.

What I am doing wrong? Thanks.

4

1 回答 1

0

您可以使用WebConfigurationManager

var myGlobalSetting = WebConfigurationManager.AppSettings["MyGlobalSetting"];
于 2018-01-03T15:05:32.717 回答