Hierarchy of .NET Configuration Files

for RuBoard

As far as hierarchy goes, there is none higher than the machine.config file. This file can be found in the %WINDIR% \Microsoft.NET\Framework\[ FrameworkVersion ]\config\ directory, where %WINDIR% is the directory in which your version of Windows is installed and [ Framework Version ] is the version number of the .NET Framework running on your machine; for example, C:\WINDOWS\Microsoft.NET\Framework\v1.0.3617\config . From that, each .NET Web application running under IIS will contain a web.config file in the root directory. If you remove or never have this web.config file, the settings contained within the machine.config file will take over. Under this, each child folder can contain a separate web.config file that provides specific settings for items and/or functionality within that directory. Figure 20.1 shows a sample of this structure. The settings that globally affect all ASP.NET applications are stored in the system.web sectionGroup of the machine.config file.

Figure 20.1. Configuration file hierarchy.

graphics/20fig01.gif

Within the files, there is another hierarchy that has certain elements that must be present. At the top of this hierarchy is the <configuration> tag. This defines the parent configuration element necessary in all XML-based application files for use with .NET. With ASP.NET, in the web.config file, the next section will be a <system.web> element. The system.web element is unique to ASP.NET and is the root element for ASP.NET configuration. That is not to say that you may only use a system.web element within a web.config file; you will also find one within the machine.config file that indicates the settings specific to ASP.NET on that machine. Listing 20.1 shows the beginning of a web.config file illustrating the <configuration> element as well as the <system.web> element.

Listing 20.1 Partial web.config File
 <?xml version="1.0" encoding="utf-8" ?> <configuration>  <system.web>   <compilation defaultLanguage="c#" debug="true" /> 

These elements are also referred to as sectionGroups . Conversely, within a configuration file, the element system.NET refers to the configuration of network files.

NOTE

A sectionGroup is an element that can be declared in an XML-based configuration file. This may be useful in a situation where you have custom settings that you need to access in your application. Custom sections and settings are discussed in the "Using Custom Attributes and Settings" section later in this chapter.


for RuBoard


. NET Framework Security
.NET Framework Security
ISBN: 067232184X
EAN: 2147483647
Year: 2000
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net