IIS7:如何定义Windows身份验证是否已经开启? [英] IIS7: How to define that windows authentication is turned on?

查看:517
本文介绍了IIS7:如何定义Windows身份验证是否已经开启?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IIS7:如何定义Windows身份验证已开启

IIS7: How to define that windows authentication is turned on?

我知道,<一个href=\"http://stackoverflow.com/questions/436169/iis7-setup-integrated-windows-authentication-like-in-iis6\">two-stage认证不能和IIS7集成模式支持,但我需要定义Windows身份验证是否已打开,让空间窗口验证功能。

I know that two-stage authentication is not supported with IIS7 Integrated mode but I need to define whether windows authentication is turned on to enable spacial windows authenticated features.

我可以定义从ASP .NET code 的IIS版本的
我可以定义Windows身份验证是从ASP .NET code

Can I define the IIS version from the ASP .NET code? Can I define that windows authentication is turned on IIS 7 from the ASP .NET code?

推荐答案

只是想分享发现的解决方案。为了得到是否Windows身份验证为启用的电流 Web应用程序执行以下操作:

Just want to share the found solution. To get whether Windows Authentication is is enabled for current web application do following:

 Microsoft.Web.Administration.ConfigurationSection windowsAuthenticationSection = Microsoft.Web.Administration.WebConfigurationManager.GetSection("system.webServer/security/authentication/windowsAuthentication");
 return windowsAuthenticationSection["enabled"];

请注意,上面的code得到有效的配置:

Please note that the code above get effective configuration:

如果有未配置为Web应用程序的设置形成父网站将被退回规定。你可以找到关于配置的传承在这里更多的信息:正与配置文件在IIS 7

If there is not configuration specified for the web application the setting form the parent web site will be returned. You can find more info about the configuration inheritance here: Working With Configuration Files in IIS 7

这篇关于IIS7:如何定义Windows身份验证是否已经开启?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆