I'm in task of migrating our product's installer from InstallShield to WiX.
To deploy web applications, the previous developers 开发者_StackOverflowused 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!
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();
}
}
}
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.
精彩评论