namespaces Element for pages (ASP.NET Settings Schema) 

Defines a collection of import directives to use during assembly pre-compilation.

This element is new in the .NET Framework version 2.0.

   <add /> 
   <remove /> 

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


Attribute Description


Optional Boolean attribute.

Defines whether the Microsoft.VisualBasic namespace is automatically imported in the applications that are in the scope of the configuration file.

The default is False.

Inherited attributes

Optional attributes.

Attributes inherited by all section elements.

Child Elements

Element Description


Optional element.

Adds a namespace to the collection of namespaces that are used during pre-compilation.


Optional element.

Removes all references to inherited namespaces, allowing only the namespaces that are added by the current add element.


Optional element.

Removes a reference to an inherited namespace from the collection of namespaces.

Parent Elements

Element Description


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


Specifies the root element for the ASP.NET configuration settings in a configuration file and contains configuration elements that configure ASP.NET Web applications and control how the applications behave.


Defines page-specific configuration settings globally, such as ASP.NET directives, for pages and controls that are within the scope of the configuration file.

The namespaces element defines a collection of import directives to use during assembly pre-compilation. This attribute corresponds to the @ Import directive on an ASP.NET page. The @ Import directive allows you to specify namespaces that are automatically imported into all pages of an application.

The following default namespaces element is configured in the root Web.config file.

      <add namespace="System" />
      <add namespace="System.Collections" />
      <add namespace="System.Collections.Specialized" />
      <add namespace="System.Configuration" />
      <add namespace="System.Text" />
      <add namespace="System.Text.RegularExpressions" />
      <add namespace="System.Web" />
      <add namespace="System.Web.Caching" />
      <add namespace="System.Web.SessionState" />
      <add namespace="System.Web.Security" />
      <add namespace="System.Web.Profile" />
      <add namespace="System.Web.UI" />
      <add namespace="System.Web.UI.WebControls" />
      <add namespace="System.Web.UI.WebControls.WebParts" />
      <add namespace="System.Web.UI.HtmlControls" />
   <!-- Other elements -->

Configuration section handler


Configuration member



Configurable locations


Root-level Web.config

Application-level Web.config

Virtual or physical directory–level Web.config


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

The .NET Framework version 2.0

Microsoft Visual Studio 2003 or Visual Studio 2005

Community Additions