469,927 Members | 1,464 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Help! I can't connect to Active Directory!

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.UnsafeNativeMetho ds.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

Jul 21 '05 #1
1 3014
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/frlrfsystemdirectoryservicesdirectorysearcherclass searchroottopic.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.

"Amadelle" <am******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
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.UnsafeNativeMetho ds.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


Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Victor Lokhmatov | last post: by
3 posts views Thread by Marc Eggenberger | last post: by
reply views Thread by Glen Darling | last post: by
3 posts views Thread by Demetri | last post: by
2 posts views Thread by Jim in Arizona | last post: by
reply views Thread by dmj07 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.