System.Web.Compilation.AppSettingsExpressionBuilder Class

Retrieves values, as specified in a declarative expression, from the <appSettings> section of the Web.config file.

See Also: AppSettingsExpressionBuilder Members

Syntax

[System.Web.Compilation.ExpressionPrefix("AppSettings")]
[System.Web.Compilation.ExpressionEditor("System.Web.UI.Design.AppSettingsExpressionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class AppSettingsExpressionBuilder : ExpressionBuilder

Remarks

The System.Web.Compilation.AppSettingsExpressionBuilder class provides access to values in the <appSettings> section of the Web.config file. The <appSettings> section of the Web.config file contains application-specific values in key/value pairs.

An application value is retrieved by assigning an expression of the form

<%$ AppSettings: appSettingsKey %>

to a property in a control declaration. The part of the expression before the colon (:) designates the type of expression to be retrieved, and the part after the colon signifies the key. The preceding expression would retrieve the following value from the Web.config file.

<appSettings>

<add key="appSettingsKey" value="appSettingsValue"/>

</appSettings>

When the page parser encounters an expression with the AppSettings prefix, it creates an instance of the System.Web.Compilation.AppSettingsExpressionBuilder class to handle the expression.

If the expression is encountered in a page that will be compiled, the System.Web.Compilation.AppSettingsExpressionBuilder object generates code to retrieve the specified value from the Web.config file. This code is executed during the execution of the generated page class. If the expression is encountered in a page that will not be compiled, the System.Web.Compilation.AppSettingsExpressionBuilder object returns the value from the Web.config file when the page is parsed and executed.

Requirements

Namespace: System.Web.Compilation
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0