expressionBuilders Element for compilation (ASP.NET Settings Schema) 

Defines a collection of resource strings to use during compilation. The resource strings associate prefixes with expression builders.

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

   <add />
   <remove />

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



Child Elements

Subtag Description


Optional element.

Adds a reference to an expression builder to the collection.


Optional element.

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


Optional element.

Removes a reference to an inherited expression builder from the collection.

Parent Elements

Element Description


Specifies the 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 section.


Configures all compilation settings that ASP.NET uses to compile applications.

The expressionBuilders element defines a collection of resource strings to use during compilation. The resource strings associate prefixes with expression builders.

When the page parser encounters an expression in an .aspx page that is delimited with the string <%$ %>, the parser creates an expression builder for the expression based on the prefix in the string. The prefix is the portion of the string that is to the left of the colon (:). For example, when the parser encounters the string <%$ ConnectionStrings:MessageDB %>, the parser creates a ConnectionStringsExpressionBuilder object. For more information, see ExpressionBuilder.

The following default expressionBuilders element is not explicitly configured in the Machine.config file or in the root Web.config file. However, it is the default configuration that is returned by application. Items are added to the expressionBuilders collection in the root Web.config file.

   <clear />

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

   <add expressionPrefix="Resources" type="System.Web.Compilation.ResourceExpressionBuilder" />
   <add expressionPrefix="ConnectionStrings" type="System.Web.Compilation.ConnectionStringsExpressionBuilder" />
   <add expressionPrefix="AppSettings" type="System.Web.Compilation.AppSettingsExpressionBuilder" />

The following code example shows how to register a custom expression builder in the Web.config file. A custom expression builder must implement the ExpressionBuilder abstract class.

To reference the expression in an .aspx file, use the following sytax:

<asp:Label ID="Label1" runat="server"

Text="<%$ MyCustomExpression:Hello, world! %>" />

              <add expressionPrefix="MyCustomExpression"

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