How to get a value in web.config of an ASP.NET MVC area? [duplicate]
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?
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
- "/Areas/AdminPanel/Views/Web.config" - Virtual Path
- "keyName" - key of your appSetting
精彩评论