Author:
武眉博<活靶子.Net>From:AspxBoy.com
Asp.Net2.0中我们可以方便的访问配置文件中,.NetFrameWork2.0新增加了 SystemWebSectionGroup 类。
允许用户以编程方式访问配置文件的
system.web 组。
比如判断web.config内是否为 debug="true",或者判断身份验证形式
SystemWebSectionGroup ws = new SystemWebSectionGroup();
CompilationSection cp = ws.Compilation;
用cp.Debug;就可以得到compilation节内关于"debug"的配置
AuthenticationSection as = ws.Authentication;
用 as.Mode 可以获取 authentication节中关于"mode"的配置,值为AuthenticationMode 枚举之一
AuthenticationMode的取值如下:
| |
成员名称 |
说明 |
| |
forms |
将基于 ASP.NET 窗体的身份验证指定为身份验证模式。 |
| |
none |
不指定身份验证。 |
| |
passport |
将 Microsoft Passport 指定为身份验证模式。 |
| |
windows |
将 Windows 指定为身份验证模式。在使用 Internet 信息服务 (IIS) 身份验证方法(基本、简要、集成 Windows (NTLM/Kerberos) 或证书)时适用此模式。 |
附:SystemWebSectionGroup 类的公共属性: