Link to home
Start Free TrialLog in
Avatar of reiszj
reiszj

asked on

Setting "AuthNTLM" property to virtual directory is not updated when using Directory Services

I am trying to set authentication for the virtual directory to use windows authentication.  It doesn't matter what value (i.e. True or False) I assign to vDir.Properties("AuthNTLM").Item(0) it doesn't seem to take and defaults to inheriting the settings from the site.  

Any ideas on overriding the inherited authentication for the site?

Here is my code:

Dim IISSchema As New DirectoryEntry("IIS://" & webSite & "/Schema/AppIsolated")
        Dim canUpdate As Boolean = Not IISSchema.Properties("Syntax").Value.ToString.ToUpper() = "BOOLEAN"
        IISSchema.Dispose()
        Dim IISAdmin As New DirectoryEntry("IIS://" & webSite & "/W3SVC/1/Root")

        If canUpdate Then
            For Each vDir As DirectoryEntry In IISAdmin.Children
                If vDir.Name = appName Then
                   vDir.Properties("AuthNTLM").Item(0) = True
                   vDir.CommitChanges()
                End If
           Next
        End If

Thanks for your help.
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

>Dim canUpdate As Boolean = Not IISSchema.Properties("Syntax").Value.ToString.ToUpper() = "BOOLEAN"

Not sure what's going in above statement
Avatar of reiszj
reiszj

ASKER

CodeCruiser thanks for your fast reply, but removing the check if IIS is running under Windows NT didn't fix the issue.  I commented out the top 3 lines and the if statement for canUpdate and I got the same result that authentication is not being changed.
ASKER CERTIFIED SOLUTION
Avatar of reiszj
reiszj

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Glad to help :-)