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

发布于 2024-09-24 21:34:32 字数 449 浏览 0 评论 0原文

我的任务是将我们产品的安装程序从 InstallShield 迁移到 WiX。

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

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

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

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

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

谢谢!

I'm in task of migrating our product's installer from InstallShield to WiX.

To deploy web applications, the previous developers used Custom Actions (written in C#) in InstallShield. In Wix, this is no longer necessary because wix supports IIS deployment.

Anyway, one of the code in the Custom Action uses the DirectoryEntry object to set the property of a Web Directory:

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

What does this setting do? I know it has something to do with security/permission, but what setting does it actually set in IIS? Does it enable one of the following:

  • Integrated Windows Authentication
  • Digest Authentication
  • Basic Authentication
  • .NET Passport Authentication

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

野の 2024-10-01 21:34:32

不久前我回答过一个类似的问题:

在应用程序级别设置 NTAuthenticationProviders 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();
    }

  }
}

A while back I provided an answer to a similar question:

Setting NTAuthenticationProviders at an Application level in IIS 6

AuthFlags (not AuthNTLM) is a flag value. You can set this without using an indexer, for example:

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();
    }

  }
}
痴者 2024-10-01 21:34:32

实际上,InstallShield 中可能也不需要它。目前,InstallShield 实际上比 WiX 具有更好的内置 IIS 支持,并且这种类型的设置可以以声明方式完成,而无需编写自定义操作。此外,收集此信息的 InstallShield UI 看起来非常像 IIS MMC 管理单元,因此数据映射方式非常直观。

Actually it probably wasn't needed in InstallShield either. Currently, InstallShield actually has better built-in IIS support then WiX and this type of setting can be done declaratively without writing a custom action. Also the InstallShield UI that collects this information looks pretty much just like the IIS MMC Snap-In so that it's intuitive how the data maps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文