Error System.DirectoryServices.DirectoryServicesCOMException (0x8007203B): A local error has occurred

1

I use following code below to verify user and password in LDAP:

        bool authentic = false;

        string ip_server = "10.53.41.21";
        string userName = "CN=test,N=Users,DC=user,DC=domain,DC=COM";
        string password = "something";
        try
        {
            DirectoryEntry entry = new DirectoryEntry("LDAP://" + ip_server, userName, password);
            //   entry.
            object nativeObject = entry.NativeObject;
            authentic = true;
        }
        catch (DirectoryServicesCOMException) { }
        return authentic;

It is run fine on local and IIS 6.0. But get error when run on IIS 7.0:

System.DirectoryServices.DirectoryServicesCOMException (0x8007203B): A local error has occurred.

   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_NativeObject()

How to fix this problem?

Thanks!

asp.net
iis-7
asked on Stack Overflow Dec 3, 2012 by user384241

1 Answer

1

You are passing the distinguishedName attribute for username, when it should be in the following format: domain\username

answered on Stack Overflow Jan 21, 2013 by Phillip Copley

User contributions licensed under CC BY-SA 3.0