ADAM authentication

From: Bill Belliveau (anonymous_at_discussions.microsoft.com)
Date: 01/31/04


Date: Fri, 30 Jan 2004 16:31:09 -0800

I've been kicking around ADAM on a 2003 server for a couple of days and after getting the major classes in the schema and making a few objects, now I'm ready to programitically test it. I am able to use the LDP tool locally or remotely to logon as a Windows Identity (admin) or as an ADAM user. I have written code to get AD objects but cant get any ADAM code working nor the examples from the documentation. I'm not sure if this is an ADAM issue or if it has more to do with my unfamiliarity with the Directory.

Below is a mess of code I've blindly been stabing around with. The exceptions I get are usually either the famous "operations error" or "unwilling to process the request" unless I'm reading the rootdse, so it seems to be a security issue. I'm accessing from a Windows 2000 box which seems to have security issues with ADAM, however LDP works.

Ideas?
Bill

-- messy code begin--
DirectoryEntry myEntry = new DirectoryEntry();
//myEntry.AuthenticationType = AuthenticationTypes.Encryption | AuthenticationTypes.Signing;
//myEntry.Path = @"LDAP://computer:50000/cn=mary baker,ou=adam users,o=microsoft,c=us";
//myEntry.Path = @"LDAP://computer:50000/o=microsoft";
//myEntry.Path = @"LDAP://computer:50000/cn=mary baker,ou=adam users,o=microsoft,c=us";
myEntry.Path = @"LDAP://computer:50000/rootdse";
myEntry.Password = "";
myEntry.Username = @"localcompany\Administrator";

try
{
Debug.Write(myEntry.Guid);
Object obj = myEntry.NativeObject;
}
catch(Exception Ex)
{
Debug.Write(Ex.ToString());
Debug.Write(Ex.InnerException);
Debug.Write(Ex.Source);
Debug.Write(Ex.HelpLink);
Debug.Write((System.Runtime.InteropServices.Marshal.GetLastWin32Error()).ToString());
}
//try
//{
//DirectoryEntry myEntry = new DirectoryEntry("LDAP://computer:50000/o=microsoft");
//
//myEntry.AuthenticationType = AuthenticationTypes.Encryption | AuthenticationTypes.Signing;
//Debug.Write(myEntry.Name + myEntry.Guid);
//Debug.Write("Logon = true");
//}
//catch(Exception Ex)
//{
//Debug.Write(Ex.ToString());
//Debug.Write(Ex.InnerException);
//Debug.Write(Ex.Source);
//Debug.Write(Ex.HelpLink);
//Debug.Write((System.Runtime.InteropServices.Marshal.GetLastWin32Error()).ToString());
//}
-------