Sdílet prostřednictvím


remove Element for configSections (General Settings Schema) 

Removes a reference to an inherited section and section group.

<remove 
   name="section name" 
/>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

name

Required String attribute.

Specifies the name of the section or section group to remove. This is the same as the name attribute in the section or sectionGroup element that added the reference.

Child Elements

None.

Parent Elements

Element Description

configuration

Specifies the required root element in every configuration file that is used by the common language runtime and the .NET Framework applications.

configSections

Specifies configuration section and namespace declarations.

sectionGroup

Defines an association between a configuration section handler and a configuration section.

Remarks

The remove element removes a reference to an inherited sections or section groups. New sections and section groups can be added to the collection in the current configuration file by using the section and sectionGroup elements.

If a configuration file tries to use a configuration section after the handler reference is removed, ASP.NET issues the server error, "Unrecognized configuration section element_name."

Example

The following code example shows how to use the remove element in an application configuration file to remove a section that was previously defined in the Machine.config file.

The following Machine.config file code declares a section named sampleSection.

<configuration>
   <configSections>
      <section name="sampleSection"
               type="System.Configuration.SingleTagSectionHandler" />
   </configSections>
   <sampleSection setting1="Value1" setting2="value two" 
                  setting3="third value" />
</configuration>

The following example application configuration file removes the sampleSection section. After removal, the application cannot retrieve the settings that are in sampleSection. If a configuration file tries to use a configuration section after the handler reference is removed, ASP.NET issues the server error, "Unrecognized configuration section element_name."

<configuration>
   <configSections>
      <clear/>
      <section name="anotherSection"
               type="System.Configuration.NameValueSectionHandler" />
    </configSections>
</configuration>

Element Information

Configuration section handler

Does not apply.

Configuration member

Remove

Remove

Configurable locations

Machine.config

Root-level Web.config

Application-level Web.config

Virtual or physical directory–level Web.config

Requirements

Microsoft Internet Information Services (IIS) version 5.0, 5.1, or 6.0

The .NET Framework version 1.0, 1.1, or 2.0

Microsoft Visual Studio 2003 or Visual Studio 2005

See Also

Reference

configSections Element (General Settings Schema)
sectionGroup Element for configSections (General Settings Schema)
section Element for configSections (General Settings Schema)
clear Element for configSections (General Settings Schema)
configuration Element (General Settings Schema)

Concepts

ASP.NET Configuration File Hierarchy and Inheritance
Format of ASP.NET Configuration Files
ASP.NET Configuration Scenarios

Other Resources

General Configuration Settings (ASP.NET)
ASP.NET Configuration Settings
ASP.NET Configuration Files
Configuring ASP.NET Applications
ASP.NET Configuration API