Help! I can't connect to Active Directory!

A

Amadelle

Hi all,
I am so desparately in need of some guidance! After two days of struggling I still can't connect to the Active Directory server. I have used so many different ways and so many different string paths and I still don't have a successful connection.

Things I have tried:

Using Directory Searcher:
DirectorySearcher ds = new DirectorySearcher();

ds.SearchRoot = new DirectoryEntry();

SearchResult rs = ds.FindOne(); //This fails

Using just DirectoryEntry:

DirectoryEntry ent = new DirectoryEntry("LDAP://myDC/CN=Users,DC=corp,DC=domainName,DC=com");

or

DirectoryEntry ent = new DirectoryEntry("LDAP://myDC.corp.domainName.com/CN=Users, DC=myDC,DC=corp, DC=domainName,
DC=com");

and many other variations of the path and I still can't connect to Active Directory and it fails. Our DC is a Windows 2003 server. I am using a Windows 2000 with VS2003 .NET and C# and I am trying to write a ASP.NET page using DirectoryServices. The Path to our LDAP is myDC.corp.domainName.com. The initial DirectoryEntry ent seems to get initialized just fine. But when I open the ent or the ds in the debugger screen .. parts of it like the children properties shows a weird message saying that there was an error with the COM object (e.g. ContainerObject <error: an exception of type: {System.Runtime.InteropServices.COMException} occurred> System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsContainer). On another newsgroup someone had suggested to reference ActiveDs COM object which I did but that hasn't helped either.


At this stage I am absolutely lost and I would appreciate any type of help. I was wondering whether I would need to log on? Whether I need to use another protocol?

What am I missing,

I appreciate any insight... or any suggestions, etc.

Thanks a million,

Amadelle
 
J

Jared

Amadelle,
If you are using an ASP.NET page did you make sure you set the <identity
impersonate="true"> attribute in the web.config file or does the account you
are using have access to read object in your domain? It also looks like you
are setting the root to a new instance, this may be causing some problems
(I'm not sure though), according to the ms documentation, the search root,
if not specified is set to nothing, and will use the root of your domain as
the search root. In this case, it's not set to nothing, but it's not set to
a valid path either. The Remarks section under the link explains.

If you are able to bind, but when you try to view/retrieve the properties, I
have found that when you try to perform operations asynchronously you
receive the comexception. Try to specify a username and password to test the
permissions, and check to see if the page is performing async calls on the
searcher.

HTH,
Jared

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemdirectoryservicesdirectorysearcherclasssearchroottopic.htm
Remarks
If SearchRoot is a null reference (Nothing in Visual Basic), the search root
is set to the root of the domain that your server is currently using.

Hi all,
I am so desparately in need of some guidance! After two days of struggling
I still can't connect to the Active Directory server. I have used so many
different ways and so many different string paths and I still don't have a
successful connection.

Things I have tried:

Using Directory Searcher:
DirectorySearcher ds = new DirectorySearcher();

ds.SearchRoot = new DirectoryEntry();

SearchResult rs = ds.FindOne(); //This fails

Using just DirectoryEntry:

DirectoryEntry ent = new
DirectoryEntry("LDAP://myDC/CN=Users,DC=corp,DC=domainName,DC=com");

or

DirectoryEntry ent = new
DirectoryEntry("LDAP://myDC.corp.domainName.com/CN=Users, DC=myDC,DC=corp,
DC=domainName,
DC=com");

and many other variations of the path and I still can't connect to Active
Directory and it fails. Our DC is a Windows 2003 server. I am using a
Windows 2000 with VS2003 .NET and C# and I am trying to write a ASP.NET page
using DirectoryServices. The Path to our LDAP is myDC.corp.domainName.com.
The initial DirectoryEntry ent seems to get initialized just fine. But when
I open the ent or the ds in the debugger screen .. parts of it like the
children properties shows a weird message saying that there was an error
with the COM object (e.g. ContainerObject <error: an exception of type:
{System.Runtime.InteropServices.COMException} occurred>
System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsContainer). On
another newsgroup someone had suggested to reference ActiveDs COM object
which I did but that hasn't helped either.


At this stage I am absolutely lost and I would appreciate any type of help.
I was wondering whether I would need to log on? Whether I need to use
another protocol?

What am I missing,

I appreciate any insight... or any suggestions, etc.

Thanks a million,

Amadelle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top