All about web.config configuration files
Posted by RAJU K, Last modified by RAJU K on 13 December 2012 11:24 PM

What is web.config?

Web.config is the main settings and configuration file for an ASP.NET web application. The file is an XML document that defines configuration information regarding the web application.This file stores the information about how the web application will act.

The web.config file contains information that controls module loading, security configuration, session state configuration, and application language and compilation settings. Web.config files can also contain application specific items such as database connection strings.

Note:  When you modify the settings in the Web.Config file, you do not need to restart the Web service for the modifications to take effect..  By default, the Web.Config file applies to all the pages in the current directory and its subdirectories.


What can be stored in Web.config file?

There are number of important settings that can be stored in the configuration file. Here are some of the most frequently used configurations, stored conveniently inside Web.config file..

1.      Database connections.

2.      Session States

3.      Error Handling (CustomError Page Settings.)

4.      Security (Authentication modes)


What is the best place to store Database connection string?

In Web.Config, you would add a key to the AppSettings Section:



 <add key="MyDBConnection" value="data source=<ServerName>;Initial catalog =<DBName>;user id=<Username>;password=<Password>;" />




<add key="ConnectionString" value= "data source=localhost;Initial catalog=northwind;user id=sa;password=mypass" />

Then, in your ASP.Net application - just refer to it like this:

                   using System.Configuration;

                   string connectionString = (string )ConfigurationSettings.AppSettings["ConnectionString"];


Please check following links for more information on data base connection strings.


How to Edit / Upload the Web.config for your website?

Caution: Before making any modifications to your web.config make sure you create a viable backup of your site that can be restored should the edits create a problem.

In a default installation, your web.config file is located in the httpdocs folder. If file extensions are not listed, it may just appear as web. Visual Studio is the program we recommend using when modifying the web.config. However, if it is not installed on your local machine, you can Notepad to make changes to the web.config file.

Options for Accessing Your Web.config
  • Use FTP to download, modify, then upload the file.
  • Use Plesk Control Panel to access and modify the file.


Use FTP to Download, Modify, and then Upload the Web.config File Back to the Server
  1. Open your FTP program on your local machine.
  2. Use FTP to access your site. 
  3. Navigate to the httpdocs folder.
  4. Select the web.config file and drag it to your local machine. 
  5. Make a copy, then modify the file as needed to resolve the issue you are working through.
  6. To send the updated file back to your server, drag the modified version to the httpdocs folder.
Use Plesk 11.x to Access and Modify the Web.Config File
  1. Log into your Control Panel.
  2. In the Subscriptions tab, click on your domain. 
  3. Click on Websites and Domains tab.
  4. Click the icon for File Manager
  5. Click on the title Name and make sure it has an arrow pointing down then click httpdocs
  6. Click on your web.config. It will open so you can edit it.
Use Plesk 9.x to Access and Modify the Web.Config File
  1. Log into your Control Panel.
  2. Click the Home tab.
  3. Click on Domains, your Domain. 
  4. Click the icon for File Manager . 
  5. Click on the title Name and make sure it has an arrow pointing down then click httpdocs.
  6. Click on your web.config. It will open so you can edit it.


Please open help pdesk ticket when you get into trouble.

Comments (2)
Avadhesh Kumar Yadav
25 February 2015 04:52 AM
CustomError Page Settings.
young kim
04 January 2017 01:26 PM
How to log into my control panel
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).