System.Web.Compilation.AppSettingsExpressionBuilder.GetAppSetting Method

Returns a value from the <appSettings> section of the Web.config file with the value converted to a target type.

Syntax

public static object GetAppSetting (string key, Type targetType, string propertyName)

Parameters

key
The key for a value to be retrieved from the configuration file.
targetType
The type of the object that contains the property entry.
propertyName
The name of the property to which the expression is bound.

Returns

The object associated with the key in the <appSettings> section of the Web.config file.

Remarks

This method retrieves the appropriate value from the key/value pairs in the <appSettings> section of the Web.config file. The value is retrieved by getting the System.Configuration.ConfigurationManager.AppSettings property with the key as the index. The resulting string value is converted to a new type based on the targetType and propertyName parameters.

Requirements

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