如何从IIS获取身份验证提供程序状态列表。对于分享点网站?

时间:2011-02-07 06:47:20

标签: sharepoint iis authentication provider

我需要在IIS中获取i web应用程序的身份验证提供程序状态吗?

例如:

X网站是否可以使用基本身份验证? 通过c#或python代码

1 个答案:

答案 0 :(得分:1)

尝试使用这样的代码:

    using (SPSite site = new SPSite("site_url_here"))
    {
      var webApp = site.WebApplication;
      var customZoneSettings = webApp.IisSettings[Microsoft.SharePoint.Administration.SPUrlZone.Custom];
      bool useBasicForCustomZone = customZoneSettings.UseBasicAuthentication;
    }

在这里,您可以获得指定站点的父SPWebApplication,并查找指定区域的IisSettings(因为不同区域可能有不同的设置)。 SPIisSettings对象包含许多有助于完成任务的属性,例如,UseBasicAuthentication。