?
Solved

DirectoryEntry LDAP From Network Computer Fails?

Posted on 2008-11-18
5
Medium Priority
?
783 Views
Last Modified: 2012-05-05

The following DirectoryEnty code works only on the actual Domain Controller.

DirectoryEntry de = new DirectoryEntry("LDAP://" + dcName, adminUser, adminPass);

I receive the following error while running this code on a networked computer.

"The specified domain either does not exist or could not be contacted"

I've tried several different dcName strings from the following DC Name with Full Domain;

 testsvr.subdomain.domain.com


0
Comment
Question by:pointeman
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:JuanCarniglia
ID: 22986683
Try,

DirectoryEntry de = new DirectoryEntry("GC://RootDSE/" + dcName, adminUser, adminPass);

or

DirectoryEntry de = new DirectoryEntry("GC://RootDSE/" + dcName, adminUser, adminPass, AuthenticationTypes.Secure);

Is your networked computer "attached" to the domain (Do you log on to it with a user of that domain, or a local user?).

if you are not logged onto the domain, you have to specify the domain name when binding to an AD object.


Greetings.
0
 

Author Comment

by:pointeman
ID: 22987044
I have 1 - Windows 2000 DC and 1 - XP Pro laptop using domain login to the DC.
I have also giving the laptop user admin rights on both local and DC to eliminate user right's problems.
I'll try you advice and let you know, thanks...
0
 

Author Comment

by:pointeman
ID: 22987187
Well niether examples worked.
Also thought I would try this with a different button_click:

Domain thisDomain = Domain.GetCurrentDomain();
lblDomain.Text = thisDomain.ToString();
 I then received this error:
"Current security context is not associated with an Active Directory domain or Forest"
 
0
 
LVL 7

Accepted Solution

by:
JuanCarniglia earned 2000 total points
ID: 22987282
Ok.

If you are logged on the domain the simple:

DirectoryEntry de = new DirectoryEntry("GC://RootDSE/" + dcName);

... should work. If it doesn't it is a security issue.

You should download and check this app out : LdapBrowser
http://download.softerra.com/files/ldapbrowser26.msi

It's a free app to surf the AD, using custom user and password. That way you can test a user's permissions on a specific object.

Greetings
0
 

Author Comment

by:pointeman
ID: 22988503
Really all I need to accomplish is return a list of all computers Names & IP's on the same subnet. I would like to find a simple solution other that the AD classes if possible. Looks like the DirectoryEntry for AD has too many variables. Some examples show ("LDAP://" + dcName) or (LDAP://RootDSE/ + dcName), etc... While non-AD networks use (WINNT://)...
Q. Do you know of a simple soluton that will find all computers & IP's in any Micosoft network?
 
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month17 days, 12 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question