3

Possible Duplicate:
does mvc support inheritance of Web.config settings throughout areas?

In ASP.NET MVC 3, I can get the appsetting value in the root web.config, but how can I get the value in web.config which is in area?

Community
  • 1
  • 1
cocc
  • 33
  • 1
  • 4

1 Answers1

3

You can access any web config by giving virtual path like this

System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/Areas/AdminPanel/Views/Web.config").AppSettings.Settings["keyName"].Value
  1. "/Areas/AdminPanel/Views/Web.config" - Virtual Path
  2. "keyName" - key of your appSetting
Chuck Norris
  • 15,207
  • 15
  • 92
  • 123