I want to know whether we can have multiple web.config file? If yes, then what is the use?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Urmila Pal
Yes, there can be multiple web.config files in an Asp.net web app. Asp.net doesn’t restrict you from that.
The root directory contains the main web.config and other web.config can be stored in the subfolders of that project. when you first run your web app the root web.config will be loaded in the cache memory of that app.
Web.config configuration settings will be overridden from previous to the current one when you open the subfolders of that project.
Web.config files are XML files with ‘.config’ the extension which contains configuration settings for your website.
They mostly contain pieces of information like:
If there is no web.config files then the web application will use the machine.config file which is the default configuration file for every site in a machine.
If you have different modules in your site and want to change configuration settings for that, then you must have different web.config files.
I hope this answer helps you.