Can I create .config file and include it to web.config?
How can i do this?
UPD.
If you want to separate config file, for example, move appSettings to another file you must do next: In web.config
<appSettings configSource="myAppSettings.config" />
In myAppSettings.config:
<appSettings>
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
It is not entirely clear what you want to do, but all configuration sections can be stored in a separate files and be referenced by the main .config file using the configSource property.
See this blog post for details.
Method 2
This is the way to integrate multiple configs into one web.config
Code in web.config:
<appSettings configSource="configappSettings.config"/>
<nlog configSource="confignlog.config"/>
<applicationSettings>
<MyApp.UI.Properties.Settings configSource="configSettings.APGUI.config"/>
<MyApp.BusinessServices.Properties.Settings configSource="configSettings.Business.config"/>
<MyApp.Auditing.Properties.Settings configSource="configSettings.Auditing.config"/>
</applicationSettings>
more: Managing complex Web.Config files between deployment environments
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0