开发者

How to get a value in web.config of an ASP.NET MVC area? [duplicate]

This question already has answers here: 开发者_运维问答 Closed 11 years ago.

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
  1. "/Areas/AdminPanel/Views/Web.config" - Virtual Path
  2. "keyName" - key of your appSetting
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜