3
可能重複:
does mvc support inheritance of Web.config settings throughout areas?如何獲取ASP.NET MVC區域的web.config中的值?
在ASP.NET MVC 3,我可以在根web.config
的appsetting
價值,但我怎麼能得到web.config
這是區裏的值?虛擬路徑
可能重複:
does mvc support inheritance of Web.config settings throughout areas?如何獲取ASP.NET MVC區域的web.config中的值?
在ASP.NET MVC 3,我可以在根web.config
的appsetting
價值,但我怎麼能得到web.config
這是區裏的值?虛擬路徑
您可以通過給虛擬路徑這樣
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/Areas/AdminPanel/Views/Web.config").AppSettings.Settings["keyName"].Value