簡體   English   中英

IIS7:如何定義Windows身份驗證已打開?

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

IIS7:如何定義Windows身份驗證已打開?

我知道IIS7集成模式不支持兩階段身份驗證,但是我需要定義是否啟用Windows身份驗證以啟用空間Windows身份驗證功能。

我可以通過ASP .NET代碼定義IIS版本嗎? 我可以定義從ASP .NET代碼在IIS 7上打開Windows身份驗證嗎?

只想分享找到的解決方案。 要獲取是否為當前的 Web應用程序啟用了Windows身份驗證,請執行以下操作:

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

請注意,上面的代碼獲得有效的配置:

如果未為Web應用程序指定配置,則將返回父網站的設置表格。 您可以在此處找到有關配置繼承的更多信息: 在IIS 7中使用配置文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM