惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
Vercel News
Vercel News
M
MIT News - Artificial intelligence
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Azure Blog
Microsoft Azure Blog
J
Java Code Geeks
Recent Announcements
Recent Announcements
Stack Overflow Blog
Stack Overflow Blog
人人都是产品经理
人人都是产品经理
IT之家
IT之家
F
Fortinet All Blogs
博客园 - 聂微东
U
Unit 42
Martin Fowler
Martin Fowler
腾讯CDC
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
量子位
阮一峰的网络日志
阮一峰的网络日志
博客园 - Franky

博客园 - づ韓じ懷飛→

基于Ajax的应用程序架构汇总 万年日历 - づ韓じ懷飛→ - 博客园 开发ASP.NET Atlas服务器端Extender控件——基本概念以及预先需求 在ASP.NET Atlas中创建自定义Behavior 为何XMLHttpRequest对象是AJAX的核心 使用Atlas简化客户端Ajax编程 .Net环境下基于Ajax的MVC方案(1) 用AJAX跟踪Google Adsense广告点击 Atlas—微软的Ajax工具包(初学者必看) GOOGLE地图自己建 asp.net将图片上传并存入SqlServer中 SQL宝典 群友 使用 Microsoft .NET 的企业解决方案模式 Ajax在.NET中与Server控件的交互 面 试 题 库 SQL Server 宝典 如何设置一个From的边界 一些.NET面试题
如何获取当前ASP.NET应用的认证模式
づ韓じ懷飛→ · 2006-04-30 · via 博客园 - づ韓じ懷飛→

NET 1.1里,

using System.Configuration;
using System.Web.Configuration;
using System.Reflection;


public AuthenticationMode GetAuthenticationMode()
{
 object auth = ConfigurationSettings.GetConfig("system.web/authentication");
 if (auth!= null)
 {
 //an internal class "System.Web.Configuration.AuthenticationConfig"
 Type t = auth.GetType();
 PropertyInfo pi = t.GetProperty("Mode",BindingFlags.Instance|BindingFlags.NonPublic);
 return (AuthenticationMode)pi.GetValue(auth,null);
  }

  return AuthenticationMode.None;
}


.NET 2.0里,

using System.Configuration;
using System.Web.Configuration;

public AuthenticationMode GetAuthenticationMode()
{
        Configuration config = WebConfigurationManager.OpenWebConfiguration("~");

        SystemWebSectionGroup swsg = (SystemWebSectionGroup)config.GetSectionGroup("system.web");

        AuthenticationSection auth = swsg.Authentication;
 return auth.Mode;
}