Accessing Configuration Settings

From Logic Wiki
Revision as of 17:06, 17 November 2014 by Macrop (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Use the ConfigurationManager from System.Configuration

var server = ConfigurationManager.AppSettings["FileServerName];

var modulesSection = ConfigurationManager.GetSection("system.web/httpModules") as HttpModulesSection;

var installedModules = modulesSection.Modules.Count;

Configuration Hierarchy

Each application inherits settings from higher level config files

  • Machine.config
  • Machine web.config
  • Parent's web.config
  • your web.config

Check : Web Config Transform