Reputation: 3064
I'm trying to migrate some code to the System.DirectoryServices.AccountManagement classes introduced in .NET 3.5
My old code worked like this and continues to work:
var directoryEntry = new DirectoryEntry("LDAP://{ip address}", "{domain}\\{users}", "{password}", AuthenticationTypes.Secure);
My new code running on same machine under the same project doesn't work:
var principalContext = new PrincipalContext(ContextType.Domain, "{domain}", "ldap://{ip address}/DC=company,DC=local", ContextOptions.Negotiate, "{users}", "{password}");
The new code throws an error "The server cannot be contacted", and I feel like it should connect since it's running the same machine and under the same Visual Studio project.
Any suggestions?
Upvotes: 0
Views: 350
Reputation: 4503
The correct input for the fourth parameter in this case is just DC=company,DC=local
.
Upvotes: 1