In ASP. net2.0, you can easily access the Web. config configuration file, such as determining debug settings and verification types.

Source: Internet
Author: User
In ASP. net2.0, we can easily access the configuration file. In netframework2.0, The systemwebsectiongroup class is added.
Allows users to access the configuration file programmatically System. Web Group.
For example, you can determine whether the Web. config file is DEBUG = "true" or the authentication form.

Systemwebsectiongroup Ws = new systemwebsectiongroup ();
Compilationsection CP = ws. compilation;
You can use CP. Debug to obtain the "debug" configuration in the compilation section.
Authenticationsection as = ws. authentication;
You can use as. mode to obtain the "Mode" configuration in the authentication section. The value is one of the authenticationmode enumerated values.
The authenticationmode value is as follows:

  Member name Description
  Forms Specify the Authentication Mode Based on ASP. NET forms.
  None No authentication is specified.
  Passport Set Microsoft Passport to Authentication mode.
  Windows Specify windows as authentication mode. This mode is applicable when you use the Internet Information Service (IIS) authentication method (basic, brief, integrated windows (NTLM/Kerberos) or certificate.


Appendix: Public attributes of the systemwebsectiongroup class:


  Name Description
Anonymousidentification ObtainAnonymousidentificationSection.
Authentication ObtainAuthenticationSection.
Authorization ObtainAuthorizationSection.
Browsercaps ObtainBrowsercapsSection.
Clienttarget ObtainClienttargetSection.
Compilation ObtainCompilationSection.
Customerrors ObtainCustomerrorsSection.
Deployment ObtainDeploymentSection.
Devicefilters ObtainDevicefiltersSection.
Globalization ObtainGlobalizationSection.
Healthmonitoring ObtainHealthmonitoringSection.
Hostingenvironment ObtainHostingenvironmentSection.
Httpcookies ObtainHttpcookiesSection.
Httphandlers ObtainHttphandlersSection.
Httpmodules ObtainHttpmodulesSection.
Httpruntime ObtainHttpruntimeSection.
Identity ObtainIdentitySection.
Isdeclarationrequired Gets a value indicating whether to declare thisConfigurationsectiongroupObject. (Inherited from configurationsectiongroup .)
Isdeclared Gets a value that indicates whether thisConfigurationsectiongroupObject. (Inherited from configurationsectiongroup .)
Machinekey ObtainMachinekeySection.
Membership ObtainMembershipSection.
Mobilecontrols ObtainMobilecontrolsSection.
Name Obtain thisConfigurationsectiongroupObject Name attribute. (Inherited from configurationsectiongroup .)
Pages ObtainPagesSection.
Processmodel ObtainProcessmodelSection.
Profile ObtainProfileSection.
Protocols ObtainProtocolsSection.
Rolemanager ObtainRolemanagerSection.
Sectiongroupname ObtainConfigurationsectiongroupThe name of the associated node group. (Inherited from configurationsectiongroup .)
Sectiongroups Obtain an object that contains allConfigurationsectiongroupObjectConfigurationsectiongroupObject.ConfigurationsectiongroupThe sub-object of the object. (Inherited from configurationsectiongroup .)
Sections Gets a configurationsectioncollection that containsConfigurationsectiongroupAll configurationsection objects in. (Inherited from configurationsectiongroup .)
SecurityPolicy ObtainSecurityPolicySection.
Sessionstate ObtainSessionstateSection.
Sitemap ObtainSitemapSection.
Trace ObtainTraceSection.
Trust ObtainTrustSection.
Type Obtain or set thisConfigurationsectiongroupObject type. (Inherited from configurationsectiongroup .)
Urlmappings ObtainUrlmappingsSection.
Webcontrols ObtainWebcontrolsSection.
Webparts ObtainWebpartsSection.
WebServices ObtainWebServicesSection.
Xhtmlconformance ObtainXhtmlconformanceSection.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.