473,378 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 3260
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Victor Lokhmatov | last post by:
Hello Everyone, My company has asked me to put a company directory on our intranet site and I'm trying to use php to extract the users from our active directory server. I've got everything...
2
by: Jay Chan | last post by:
We have just installed a SQL Server 2000 (SP 3A) onto a computer that has Windows-2003 Server on it. Now, we cannot get access to that database server from other computers. Seem like this may be an...
2
by: Sara | last post by:
Dear Sir, I want to access to a special group in active directory but with this function I could just see that a special user is exist in active directory or not, I mean I want to see that a user...
3
by: Marc Eggenberger | last post by:
Hi there. I have the following environment: Active Directory running on Windows 2000. There is a root domain called ad.sys and within this root domain there are the following subdomains: ...
0
by: Glen Darling | last post by:
Morning everyone, I am looking for help with an active directory search I am trying to figure out. For a while now I have been banging my head against a wall trying to figure out how to...
3
by: Demetri | last post by:
Hello, My company has charged me with creating a web service that will validate a user and return the user's roles via Active Directory. The requirement is that the web service must return...
3
by: Lucky | last post by:
Hi guys, after long long time. i'm back again with another problem. this time i think the problem is very very interesting and i really need you help on this. i'm trying to connect to the...
2
by: Jim in Arizona | last post by:
My goal, somehow, is to populate a dropdownlist with all the user names in active directory. I don't even know where to begin, really. I added a reference to System.DirectoryServices so I could...
0
by: dmj07 | last post by:
Hi, I need some help with my Active Directory coding in C#. All I am trying to do is quey the active directory on my server to return information about a user such as first name, surname etc. Here...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.