. Net webconfig gets the debug value

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 system. Web Group of the configuration file programmatically.
For example, you can determine whether the Web. config file is DEBUG = "true" or the authentication form.

System. configuration. Configuration configuration = webconfigurationmanager... openwebconfiguration ("");)

// Virtual directory of the configuration file. If null, the Web. config file under the root directory is used.

Systemwebsectiongroup Ws = (systemwebsectiongroup) configuration. getsectiongroup ("system. Web ");
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 specifies the Authentication Mode Based on ASP. NET forms.
Authentication is not specified for none.
Passport specifies Microsoft Passport as authentication mode.
In Windows, specify the Authentication Mode for Windows. 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:
Description
Anonymousidentification get anonymousidentification section.
Authentication to obtain the authentication section.
Authorization to obtain the authorization section.
Browsercaps gets the browsercaps section.
Clienttarget obtains the clienttarget section.
Compilation gets the compilation section.
Merrors obtains the customerrors section.
Deployment gets the deployment section.
Devicefilters get devicefilters section.
Globalization gets the globalization section.
Healthmonitoring gets the healthmonitoring section.
Hostingenvironment gets the hostingenvironment section.
Httpcookies get httpcookies.
Httphandlers get httphandlers section.
Httpmodules gets the httpmodules section.
Httpruntime to get the httpruntime section.
Identity to obtain identity.
Isdeclarationrequired gets a value indicating whether the configurationsectiongroup object needs to be declared. (Inherited from configurationsectiongroup .)
Isdeclared gets a value indicating whether the configurationsectiongroup object has been declared. (Inherited from configurationsectiongroup .)
The machinekey to obtain the machinekey section.
Get the membership section for membership.
Mobilecontrols get mobilecontrols section.
Name gets the name attribute of the configurationsectiongroup object. (Inherited from configurationsectiongroup .)
Pages to obtain the pages section.
Processmodel gets the processmodel section.
Profile to obtain the profile section.
Protocols gets the protocols section.
Rolemanager obtains the rolemanager section.
Sectiongroupname gets the name of the section group associated with this configurationsectiongroup. (Inherited from configurationsectiongroup .)
Sectiongroups gets a configurationsectiongroup object that contains all the configurationsectiongroup objects, which are sub-objects of the configurationsectiongroup object. (Inherited from configurationsectiongroup .)
Sections obtains a configurationsectioncollection, which contains all the configurationsection objects in the configurationsectiongroup. (Inherited from configurationsectiongroup .)
SecurityPolicy to obtain the securityPolicy section.
Sessionstate to obtain the sessionstate section.
Sitemap obtains the sitemap section.
Trace to obtain the trace section.
Trust to obtain the trust Section.
Type gets or sets the type of the configurationsectiongroup object. (Inherited from configurationsectiongroup .)
Urlmappings to obtain the urlmappings section.
Webcontrols get webcontrols section.
Webparts: Obtain the webparts section.
WebServices get WebServices section.
Xhtmlconformance gets the xhtmlconformance section.

Http://www.cnblogs.com/Fly-sky/admin/EditPosts.aspx? Postid = 1374179

Http://fly-sky.cnblogs.com/
The above information andArticleThe body is an integral part. If you want to repost this article, please keep the above information. Thank you!

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.