Easy access to profile web.config in asp.net2.0, such as determining debug settings, validating types

Source: Internet
Author: User

In asp.net2.0 we can easily access the configuration file,. NetFrameWork2.0 adds a new SystemWebSectionGroup class.

Allows users to programmatically access the configuration file's system.web group.

For example, to determine whether the web.config is debug= "true", or to determine the form of authentication

SystemWebSectionGroup ws = new SystemWebSectionGroup ();

Compilationsection CP = Ws.compilation;

With CP. Debug, you can get the configuration on "Debug" in the compilation section

Authenticationsection as = ws. authentication;

With AS. Mode can get the configuration for "mode" in the authentication section, which is one of the Authenticationmode enumerations

The Authenticationmode values are as follows:

Description of Member name

Forms Specifies authentication based on ASP.net forms as an authentication mode.

None does not specify authentication.

Passport specifies Microsoft Passport as the authentication mode.

Windows specifies windows as the authentication mode. This mode is applicable when using the Internet Information Services (IIS) authentication method (Basic, concise, integrated Windows (Ntlm/kerberos), or certificates).

Attached: 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.

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.