Elements in a web.config File
The web.config file is a text file which contains XML elements that affect the behavior of an application. The following are some of the mportant tags in a web.config file.
<configuration>
In a Web.config file, all the configuration information for an
ASP.NET application must reside between the <configuration>
and </configuration> tags. This is the root node, which contains
the declaration of all other sections of the Web.config file.
<appSettings>
This section of the Web.config file provides a way to define
custom application settings for an application. The section
can have multiple <add> subelements.
<appSettings>
<add key="connectionstring" value="localhost;uid=readonly;pwd=user"/>
</appSettings>
<compilation>
This element sets several compilation settings for the
application. Some of the settings involve setting a default
language and debug option for the application setting. Debug
pages are larger and execute more slowly, so you should use them
only for testing purposes. This section also provides support for
the <compilers>, <assemblies> , and <namespaces> subelements.
<namespaces>
This subelement is used to add or remove namespace references for
assemblies that must be made available when compiling Web pages.
<authentication>
The <authentication> element sets the authentication policy for
the application. Possible modes are "Windows," "Forms,"
"Passport," and "None."
<pages>
The <pages> element allows configuration of page application
specific settings.
<customErrors>
The <customErrors> element provides a means for defining custom
error messages for an ASP.NET application. This is generally
used to point users to a friendlier message than the default
error messages. The <customErrors> element section supports
multiple <error> subelements that are used to define custom errors.
Related Topics