Web.config settings and configuration file advantages.

The custom settings are written as simple string variables.we can use a special web.config setting for several reasons:

To centralize an important setting that needs to be used in many different pages: For example, we could create a variable that stores a database query. Any page that needs to use this query can then retrieve this value and use it.

To make it easy to quickly switch between different modes of operation: For example, we might create a special debugging variable. Our web pages could check for this variable and, if it’s set to a specified value, output additional information to help us test the
application.

To set some initial values: Depending on the operation, the user might be able to modify these values, but the web.config file could supply the defaults.

 

The ASP.NET configuration files have following advantages:

Never locked: we can update web.config settings at any point, even while our application is running. If there are any requests currently under way, they’ll continue to use the old settings, while new requests will get the changed settings by itself.
 
Easily accessed and replicated: If we have the appropriate network rights,we can change a web.config file from a remote computer not only this we can copy the web.config file and use it to apply identical settings to another application or another web server that runs the same application in a web farm scenario.

The settings are easy to edit and understand: The settings in the web.config file are humanreadable,which means they can be edited and understood without needing a special configuration tool.

Next Recommended Reading CustomError mode in web.config file