What is the Web.config file in ASP?

Configuration file is used to manage various settings that define a website. The settings are stored in XML files that are separate from your application code. In this way you can configure settings independently from your code. Generally a website contains a single Web.config file stored inside the application root directory. However there can be many configuration files that manage settings at various levels within an application.

Usage of configuration file

ASP.NET Configuration system is used to describe the properties and behaviors of various aspects of ASP.NET applications. Configuration files help you to manage the settings related to your website. Each file is an XML file (with the extension .config) that contains a set of configuration elements. Configuration information is stored in XML-based text files.

Benefits of XML-based Configuration files

  • ASP.NET Configuration system is extensible and application specific information can be stored and retrieved easily. It is human-readable.
  • You need not restart the web server when the settings are changed in configuration files. ASP.NET automatically detects the changes and applies them to the running ASP.NET application.
  • You can use any standard text editor or XML parser to create and edit ASP.NET configuration files.