| |||||||||||||||||||||||||||||||||||||||||||
<configSections> section ElementASP.NET Syntax ASP.NET Configuration Sections Defines an association between a configuration section handler and a configuration element. <section name = "section name" type = "configuration section handler class, assembly file name, version, culture, public key token" allowDefinition= "Everywhere | MachineOnly | MachineToApplication | MachineToWebRoot" allowLocation = "true | false" restartOnExternalChanges = "true | false" /> Attributes and ElementsThe following sections describe attributes, child elements, and parent elements. Attributes
Child ElementsNone. Parent Elements
RemarksA section element associates a configuration section handler with a configuration element or section. This is required because ASP.NET makes no presumptions about how to handle settings within a configuration file. Instead, ASP.NET delegates the processing of configuration data to configuration section handlers. Each section element identifies a configuration section or element and the associated class that is derived from ConfigurationSection that handles the configuration section or element. The section elements can be logically grouped in sectionGroup elements for organization and to help avoid naming conflicts. The section and sectionGroup elements are contained in the configSections element. Default ConfigurationConfiguration sections for the .NET configuration elements are defined in the Machine.config file and are too numerous to list here. The following excerpt from the Machine.config file defines the configuration section handler for the authentication element of the system.web section. Then, configuration settings are defined for the authentication element. If a configuration section handler is not associated with a configuration element, ASP.NET issues the server error,
<configuration>
<configSections>
<sectionGroup name = "system.web"
type = "System.Web.Configuration.SystemWebSectionGroup, System.Web,
Version=%ASSEMBLY_VERSION%, Culture=neutral,
PublicKeyToken=%MICROSOFT_PUBLICKEY%">
<section name = "authentication"
type = "System.Web.Configuration.AuthenticationSection, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
allowDefinition = "MachineToApplication" />
</sectionGroup>
</configSections>
<system.web>
<authentication mode = "Windows">
<forms name = ".ASPXAUTH"
loginUrl = "login.aspx"
defaultUrl = "default.aspx"
protection = "All"
timeout = "30"
path = "/"
requireSSL = "False"
slidingExpiration = "True"
cookieless = "UseCookies"
domain = ""
enableCrossAppRedirects = "False">
<credentials passwordFormat = "SHA1" />
</forms>
<passport redirectUrl = "internal" />
</authentication>
<!-- Other system.web elements -->
</system.web>
<!-- Other configuration settings -->
</configuration>
ExampleThe following shows an excerpt from the root web.config file of aspxtreme. The code example shows how a custom configuration section named sourceView ( and the settings for that section ) is defined. <configuration xmlns = "http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<sectionGroup name = "system.web">
<section name = "sourceView"
type = "System.Configuration.NameValueSectionHandler, System,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
<!-- Other configuration settings -->
<system.web>
<sourceView>
<add key = "root" value="d:\web projects\aspxtreme" />
</sourceView>
<!-- Other system.web settings -->
</system.web>
</configuration>
See Also<configSections> Section <configSections> sectionGroup Element ConfigurationSection 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
You can help support aspxtreme