| |||||||||||||||||||||
<appSettings> SectionASP.NET Syntax ASP.NET Configuration Sections Contains custom application settings, such as file paths, XML Web service URLs, or any information that is stored in the.ini file for an application. <appSettings file = "relative file name" > <add /> <clear /> <remove /> </appSettings> Attributes and ElementsThe following sections describe attributes, child elements, and parent elements. Attributes
Child Elements
Parent Elements
RemarksThe appSettings element stores custom application configuration information, such as file paths, XML Web service URLs, or any information that is stored in the.ini file for an application. The key/value pairs that are specified in the appSettings element can be accessed in code using the ConfigurationSettings class. You can use the file attribute to specify a configuration file that provides additional settings or overrides the settings that are specified in the appSettings element. You can use the file attribute in source control team development scenarios, such as when a user wants to override the project settings that are specified in an application configuration file. Configuration files that are specified in a file attribute must have the appSettings element rather than configuration element as the root node. In the .NET Framework version 2.0 applications, store database connection strings in the connectionStrings element collection instead of the application settings collection. Default ConfigurationThe following default appSettings 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. <appSettings file = "">
<settings>
<clear />
</settings>
</appSettings>
ExampleConfiguration files that are specified in a file attribute must have the appSettings element rather than the configuration element as the root node. The following code example demonstrates how to use the correct form for a configuration file that is specified in the file attribute. <?xml version = "1.0" encoding = "utf-8" ?> <appSettings> <add key = "Application1" value="MyApplication1" /> <add key = "Setting1" value="MySetting" /> </appSettings> The following code example shows how to define a custom application setting in a configuration file. <configuration>
<appSettings>
<add key = "Application Name" value="MyApplication" />
</appSettings>
</configuration>
See AlsoASP.NET Configuration AppSettingsSection Class |
| ||||||||||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note