About Web Configuration Files
In .Net we use configuration files to manage the settings of a website. Web configuration files are different from application codes. These files are stored in XML files. These files help you to independently configure settings of your web application. Each website contains a single web.config files at the root directory. To manage applications settings at different level multiple config files can be used.
Web config file hierarchy:
There are many settings related to your website that are managed by web.config files. These files are xml files that contains elements. These elements are used to define security information, database connection strings and more. If there are multiple configuration files then it is important to understand, how these files work together.
On a machine there is a global configuration file Machine.config , that is used by all sites on the machine. Here is the location of this file:
This file is used for the settings of all sites running on the server. To provide more granular control these files can also be used inside individual website directories.
Level - 2 Web Config (Directory - 1) web Config (Director 2)
Level - 1 web.Config website
Level - 0 Machine.config file
Configuration files in each direct will override the setting defined in the parent directory setting.