Could you please tell me how we will use more than 1 web.config file in asp.net?
2 Answers
You can use multiple web.config in different directories in the web application. This will help you to override any parent folder config settings
Comments
You can't use multiple web.config files as far as I know. You can however run create a new website that uses a different web.config file and has duplicate files.
If there is a particular setting you want to be variable, then your design sounds a bit inefficient and you should probably be handling those values outside the web.config file.
You can also split your config file into multiple parts, which is useful if it's hard to manage and want to modularise it. Do as follows:
Your Main.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings file="YourSettings.config" />
<system.web>
<!-- Continue as normal -->
</system.web>
</configuration>
Then create YourSettings.config
<!-- Referenced by Web.config -->
<appSettings>
<add key="Key" value="MyVal" />
</appSettings>
configSourceattribute, in order to break up a large config file into smaller pieces. These two serves completely different purposes. So the question is: for what purpose do are you planning to use several config files?