473,487 Members | 2,452 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 3269
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
5509
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
2133
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
734
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
3109
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
1046
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
5320
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
11265
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
5944
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
893
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...
0
7106
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5442
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
267
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.