Share via


Adding Custom Configuration Settings for Extending Virtual Servers

The \60\CONFIG folder contains .config and .xml files that are used together to create the web.config file for a virtual server when it is extended with Microsoft® Windows® SharePoint™ Services. Before copying the web.config file from the \60\CONFIG folder to the root folder of the virtual server, Windows SharePoint Services searches the \60\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 virtual server. The actions defined in the .xml file are applied to the configuration settings of the virtual server. 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.

When saved as webconfig.myName.xml in the \60\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 virtual server 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.

These actions are applied to configuration settings when one of the ExtendVirtualServer methods or the ExtendVirtualServerInWebFarm method of the SPGlobalAdmin class is called. If there are several webconfig.myName.xml files, the order in which they apply is not guaranteed.

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.

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