|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Working with Web.config Files
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
You may need to modify Web.config files to make your solution work in the Windows SharePoint Services environment. For example, you might need to add a SafeControl entry, register an HttpModule, or customize SessionState, but a Windows SharePoint Services deployment includes numerous Web.config files, one in each Web application, and one in each front-end Web server.
To make customizing Web.config files easier, Windows SharePoint Services provides two ways to make changes. First, you can declaratively register Web.config entries by creating an XML file that describes a set of Web.config modifications. To do this, you create a custom webconfig.XYZ.xml file in \\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG, where XYZ is a unique ID that you use to identify your solution. For an example that shows how to create a custom Web.config file to change settings, see How To: Add Custom Configuration Settings to Extend a Web Application.
In addition to creating a custom Web.config file, however, you can use the Windows SharePoint Services object model to modify Web.config settings. For an example that shows how to modify settings programmatically, see How To: Use the Object Model to Modify Web.config.
Changes that you define through the object model or through XML are always applied when you create a Web application.
Web.config files are contained in the following folders within the file system:
\\Inetpub\wwwroot\wss\VirtualDirectories\Port_Number — The Web.config file that defines configuration settings for a SharePoint content application. In addition, the \wpresources folder contains a Web.config file used in Web Part resources.
\\Program Files\Common Files\Microsoft Shared\Web Server Extensions\wpresources — A Web.config file that is used in Web Part resources for the global assembly cache.
The Web.config files in the \wpresources folders should not be modified. The settings of these files disallow pages or items that can be compiled. If these settings are changed, the security state for the compiled code differs greatly from the security state for code that runs from the Local_Drive:\Inetpub\wwwroot directory.
\\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\CONFIG — The Web.config file and other .config files that together define configuration settings for extending other Web applications.
\\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI — The Web.config file that defines configuration settings for the /_vti_bin virtual directory.
\\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS — The Web.config file that defines configuration settings for the /_layouts virtual directory.
\\Inetpub\wwwroot\wss\VirtualDirectories\Port_Number — The Web.config file that defines configuration settings for the SharePoint Central Administration application.
When an IIS Web site is extended with Windows SharePoint Services, a top-level Web.config file is placed within the content root folder of the Web application, which defines configuration settings for the server such as HTTP handling for Web Parts. Another Web.config file used for Web Part resources is placed in a \wpresources folder within the same content root folder.
Changes that you make to Web.config may be overwritten when you install updates or service packs for Windows SharePoint Services, or when you upgrade an installation to the next product version.