
<appSettings> | 425
web.config
Reference
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
web.config Elements
<configuration>
<configuration>
</configuration>
The root element for all configuration files; it is required.
Scope
All
Attributes
None
<appSettings>
<appSettings>
</appSettings>
The <appSettings> element can be used to configure custom application settings
as key/value pairs. These settings can later be retrieved at runtime using the
AppSettings property of the
ConfigurationSettings class, as shown in the
example. This property is shared (static) and does not require the
ConfigurationSettings class to be instantiated before accessing the property.
Scope
Any
Attributes
None
Child Elements
<add>
The key/value pair to add.
<remove>
The key to remove.
<clear>
Clears all previously added key/value pairs.
Example
The following web.config section sets an application level key/value pair:
<configuration>
<appSettings>
<add key="applicationConfigKey" value="bar"/>
</appSettings>
</configuration>