This question seems to have been asked quite a bit, but no one has solved the problem for me. I have an ASP.NET MVC4 application with scope. Inside this area, I have web.config with overridden settings. These settings do not seem to be matched when trying to read them in a controller within an area.
-MyApp -Areas -MyArea -Controllers -MyController -Web.config -Web.config
In MyApp\Web.config , I have:
<appSettings> <add key="DefaultDisplayMode" value="Configuration" /> </appSettings>
In MyApp\Areas\MyArea\Web.config I have:
<appSettings> <add key="DefaultDisplayMode" value="Review" /> <add key="SubSetting" value="Testing" /> </appSettings>
In MyController , if I request application settings, I see:
DefaultDisplayMode: Configuration
I expect to see:
DefaultDisplayMode: Review SubSetting: Testing
I tried with both:
System.Configuration.ConfigurationManager.AppSettings["..."] System.Web.Configuration.WebConfigurationManager.AppSettings["..."]
I even tried with the following (above the top) structure with no luck:
-MyApp -Areas -MyArea -Controllers -MyController -Web.config -Web.config -Web.config
Does anyone know why my appSettings subdirectory is not working?
source share