代码之家  ›  专栏  ›  技术社区  ›  Ian manuel aldana

当您使用DirectoryEntry对象设置web目录属性“AuthNTLM”时,您实际更改的是什么IIS设置?

  •  1
  • Ian manuel aldana  · 技术社区  · 15 年前

    为了部署web应用程序,以前的开发人员在InstallShield中使用自定义操作(用C编写)。在Wix中,这不再是必需的,因为Wix支持IIS部署。

    无论如何,自定义操作中的一个代码使用DirectoryEntry对象设置Web目录的属性:

    DirectoryEntry.Properties["AuthNTLM"][0] = true;
    

    这个设置有什么作用?我知道它与安全/权限有关,但它在IIS中实际设置了什么设置?是否启用以下功能之一:

    • 集成Windows身份验证
    • 摘要式身份验证
    • 基本身份验证
    • .NET Passport身份验证

    2 回复  |  直到 15 年前
        1
  •  2
  •   Community Mohan Dere    8 年前

    不久前,我对一个类似的问题给出了一个答案:

    Setting NTAuthenticationProviders at an Application level in IIS 6

    AuthFlags AuthNTLM )是一个标志值。可以在不使用索引器的情况下进行设置,例如:

    int MD_AUTH_ANONYMOUS = 1;
    int MD_AUTH_BASIC = 2;
    int MD_AUTH_NT = 4;
    
    using(DirectoryEntry w3svc = new DirectoryEntry(@"IIS://Localhost/W3SVC"))
    {
      using(DirectoryEntry webSite = w3svc.Children.Add(iisNumber, "IIsWebServer"))
      {
        // Configure website settings here...
        ....
        webSite.CommitChanges();
    
        using(DirectoryEntry siteRoot = webSite.Children.Add("root",
                                            IISSchemaClasses.IIsWebVirtualDir))
        {
          // Configure root application settings...
          ....
          // Only allow Basic and NTLM authentication
          siteRoot.Properties["AuthFlags"].Value = MD_AUTH_BASIC | MD_AUTH_NT 
          siteRoot.CommitChanges();
        }
    
      }
    }
    
        2
  •  1
  •   Christopher Painter    15 年前