How To: Add Custom Configuration Settings to Extend a Web Application

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.

The \\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG folder contains .config and .xml files that are used together to create the Web.config file for a Web application when it is extended with Windows SharePoint Services. Before copying the Web.config file from the \CONFIG folder to the root folder of the Web application, Windows SharePoint Services searches the \CONFIG folder for any .xml file with a name in the format webconfig.*.xml and merges its contents with the Web.config file before writing the resulting Web.config file to the root path of the Web application. The actions defined in the .xml file are applied to the configuration settings of the Web application. A major advantage to using an .xml file to supplement the Web.config file is that customizations are not lost when Windows SharePoint Services is upgraded and the Web.config file is overwritten.

Example

When saved as webconfig.myName.xml in the \CONFIG directory, the following example adds a safe control and replaces the run-time filter for the resulting Web.config file that is created when a Web application is extended.

<actions>
   <add path="configuration/SharePoint/SafeControls">
      <SafeControl
         Assembly="System.Web, Version=1.0.5000.0, Culture=neutral, 
            PublicKeyToken=b03f5f7f11d50a3a"
         Namespace="System.Web.UI.WebControls"
         TypeName="*"
         Safe="True"/>
   </add>
   <remove path="configuration/SharePoint/RuntimeFilter"/>
   <add path="configuration/SharePoint">
      <RuntimeFilter
         Assembly="Company.Product, Version=1.0.1000.0, 
            Culture=neutral, PublickKeyToken=1111111111"
         Class="MyRuntTimeFilter",
         BuilderUrl="MyBuilderUrl"/>
   </add>
</actions>

The example adds a new SafeControl child element on the path configuration/SharePoint/SafeControls, removes the RuntimeFilter element from the configuration/SharePoint/RuntimeFilter path, and adds a new RuntimeFilter element on the configuration/SharePoint path.

You can retroactively apply changes to the Web.config files of the server by running the copyappbincontent Stsadm command-line operation. You must run the operation on each front-end Web server in the deployment.

For general information about the Web.config files used in a Windows SharePoint Services deployment, see Working with Web.config Files

Warning

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.

See Also

Concepts

Working with Web.config Files

How To: Use the Object Model to Modify Web.config