Advantages of Web.config file web application which contains web.config file. Every day we are using web.config file but most of the developers are not familiar with usage and advantages of web.config file. This article will helps the developers to identifying the exact advantages of web.config file and its usage.

Below are the list of basic advantages of web.config file
1. Connection string settings
2. AppSettings
3. HTTP Handlers settings
4. Custom Error configurations
5. Session state and View State configurations
6. Authentication, Authorization settings
7. Custom Configuration settings

Connection string settings

The is one of the most common section in web.config file. It allow the users to create multiple connection strings here. Below are the general connection string settings

connection string


The AppSettings configuration which helps the developers to create their custom keys, file paths, URLS etc... Below are the general settings for AppSettings


Handlers settings

HttpHandler is a code that executes when an http request for a specific resource is made to the server. For example, if we request an .aspx page the ASP.NET page handler is executed.

Below are the details of http handler settings for image handler

Handler Settings

Custom Error configurations

We can set our custom error code configurations based on the Error code so whenever we get the error code while running the application it will redirect to the custom error page because of this we no need to write any C# code. The Web config custom error code configuration will handle this error.
Below are the details of custom error configurations.

Custom Error configurations

Session state and View State configurations

We can enable our Session state and View State settings in web.config itself. Below is the configuration of enabling view state through web. Config.

View State configurations

Here we can set true / false based on our requirement

The below is the configuration which is used to define Session State configurations

Session State

Authentication, Authorization settings

Another one of the cool feature in web.config is Authorization and Authentication settings

Below are the general settings for Authentication and Authorization

Authentication Settings

Authentication Settings

Authorization Settings


The page will display according to the above settings.

Custom Configuration settings

In this section we can define our own settings like color settings, custom URL settings etc..Below are the example for custom configuration settings
Custom configuration

Likewise we can define our custom configurations.These are all the some basic advantages of web. Config.


Author: Vetriselvan05 Aug 2014 Member Level: Silver   Points : 0


That was a good article. Really a useful one!!!!


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: