IIS7:如何定义Windows身份验证已打开?
我知道IIS7 集成模式不支持两阶段身份验证 https://stackoverflow.com/questions/436169/iis7-setup-integrated-windows-authentication-like-in-iis6但我需要定义是否打开 Windows 身份验证以启用空间 Windows 身份验证功能。
我可以定义IIS版本吗来自 ASP .NET 代码?
我可以定义Windows身份验证已打开IIS 7来自 ASP .NET 代码?
只是想分享找到的解决方案。获取是否启用 Windows 身份验证currentWeb 应用程序执行以下操作:
Microsoft.Web.Administration.ConfigurationSection windowsAuthenticationSection = Microsoft.Web.Administration.WebConfigurationManager.GetSection("system.webServer/security/authentication/windowsAuthentication");
return windowsAuthenticationSection["enabled"];
请注意,上面的代码获得有效的配置:
如果没有为 Web 应用程序指定配置,则将返回父网站的设置。您可以在此处找到有关配置继承的更多信息:在 IIS 7 中使用配置文件 http://technet.microsoft.com/en-us/library/cc754617%28WS.10%29.aspx
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)