In Asp.Net2.0, we can easily access the configuration file. .NetFrameWork2.0 has added the SystemWebSectionGroup class.
The system.web group that allows users to access configuration files programmatically.
For example, determine whether debug="true" is set in web.config, or determine the authentication form
SystemWebSectionGroup ws = new SystemWebSectionGroup();
CompilationSection cp = ws.Compilation;
Use cp.Debug; to get the "debug" configuration in the compilation section.
AuthenticationSection as = ws.Authentication;
Use as.Mode to get the configuration of "mode" in the authentication section, the value is one of the AuthenticationMode enumerations
The values of AuthenticationMode are as follows:
Member name description
Forms specifies ASP.NET Forms-based authentication as the authentication mode.
None does not specify authentication.
Passport Specifies Microsoft Passport as the authentication mode.
Windows Specifies Windows as the authentication mode. This mode applies when using Internet Information Services (IIS) authentication method (Basic, Brief, Integrated Windows (NTLM/Kerberos), or Certificate).
Attachment: Public properties of the SystemWebSectionGroup class:
Name Description
AnonymousIdentification Gets the anonymousIdentification section.
Authentication Gets the authentication section.
Authorization Gets the authorization section.
BrowserCaps Gets the browserCaps section.
ClientTarget Gets the clientTarget section.
Compilation Gets the compilation section.
CustomErrors Gets the customErrors section.
Deployment Gets the deployment section.
DeviceFilters Gets the deviceFilters section.
Globalization Gets the globalization section.
HealthMonitoring Gets the healthMonitoring section.
HostingEnvironment Gets the hostingEnvironment stanza.
HttpCookies Gets the httpCookies section.
HttpHandlers Gets the httpHandlers section.
HttpModules Gets the httpModules section.
HttpRuntime Gets the httpRuntime section.
Identity Gets the identity section.
IsDeclarationRequired Gets a value indicating whether this ConfigurationSectionGroup object needs to be declared. (Inherited from ConfigurationSectionGroup.)
IsDeclared Gets a value indicating whether this ConfigurationSectionGroup object has been declared. (Inherited from ConfigurationSectionGroup.)
MachineKey Gets the machineKey section.
Membership Gets the membership section.
MobileControls Gets the mobileControls section.
Name Gets the name property of this ConfigurationSectionGroup object. (Inherited from ConfigurationSectionGroup.)
Pages Gets the pages section.
ProcessModel Gets the processModel section.
Profile Gets the profile section.
Protocols Gets the protocols section.
RoleManager Gets the roleManager section.
SectionGroupName Gets the section group name associated with this ConfigurationSectionGroup. (Inherited from ConfigurationSectionGroup.)
SectionGroups Gets a ConfigurationSectionGroup object that contains all ConfigurationSectionGroup objects that are children of this ConfigurationSectionGroup object. (Inherited from ConfigurationSectionGroup.)
Sections Gets a ConfigurationSectionCollection that contains all ConfigurationSection objects in this ConfigurationSectionGroup. (Inherited from ConfigurationSectionGroup.)
SecurityPolicy Gets the securityPolicy section.
SessionState Gets the sessionState section.
SiteMap Gets the siteMap section.
Trace Gets the trace section.
Trust Gets the trust section.
Type Gets or sets the type of this ConfigurationSectionGroup object. (Inherited from ConfigurationSectionGroup.)
UrlMappings Gets the urlMappings section.
WebControls Gets the webControls section.
WebParts Gets the webParts section.
WebServices Gets the webServices section.
XhtmlConformance Gets the xhtmlConformance section.
http://huobazi.cnblogs.com/archive/2006/05/18/systemwebsectiongroup.html