.Net Configuration Files Confused

We have a somewhat complex project, which the original developers divided into several projects for the organization. For me, this means that I have an ASP.Net site with web.config and contains all kinds of good settings and another project that compiles into a DLL that has its own .config file, app.config.

In the DLL, it would be very nice to have access to all the AppSettings that I have in the ASP.Net web.config protejct file.

Is it possible? Is this a good practice? I really do not want to copy and paste the same information and manually synchronize them between the two (in fact, maybe up to 20 - this is a big project, but someone organized it to an absurd level) .config files.

Any suggestions or recommendations?

+5
source share
2 answers

This is the default behavior - ConfigurationManager.AppSettingsreads the current web.configfor all DLLs.
Sometimes files .configare created for other projects (or dll), but they are not used on the site and should be combined into web.config.

+3
source

System.Web.Configuration.WebConfigurationManager.AppSettings accesses web.configfrom any class library. Just remember to add a link to System.Configurationand System.Webto any library that needs to access this.

pratice, , / web.config, - ASP.NET -. web.config <appSettings>, app.settings.

0

All Articles