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

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
Google Developers Blog
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
人人都是产品经理
人人都是产品经理
U
Unit 42
B
Blog RSS Feed
博客园 - 【当耐特】
T
Tailwind CSS Blog
V
V2EX
S
SegmentFault 最新的问题
美团技术团队
Apple Machine Learning Research
Apple Machine Learning Research
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
量子位
aimingoo的专栏
aimingoo的专栏
Stack Overflow Blog
Stack Overflow Blog
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
P
Proofpoint News Feed
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
About on SuperTechFans

博客园 - づ韓じ懷飛→

基于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;
}