You have custom configuration information for
your application that you
would like to store in its
web.config file for your application
by adding an
<appSettings> section to
contain the custom configuration settings.
web.config file in the root directory
of your application (or create one if it does not already exist).
<add> child elements along with
value pairs to the
<appSettings> element as required.
In the code-behind class for your ASP.NET page, use the .NET language
of your choice to access the
key/value collection through the
Example 9-1 through Example 9-4 show the sample code we’ve
written to implement this solution. Example 9-1
web.config file with some
value pairs. Example 9-2 shows the
.aspx file for
a web form that displays the configuration settings. Example 9-3 (VB) and Example 9-4 (C#)
show the code-behind class that accesses the configuration settings
ASP.NET lets you add and then access configuration information
specific to your application to the
file by means of a special
element. You can add application configuration information by adding
<add> child element for each parameter,
key attribute to the name of the
configuration parameter, and then setting the
value attribute to ...