Problem specifying right Active Directory path

Posted on 2005-04-21
Last Modified: 2010-04-16
Hi guys,

I am getting the following error when I try to run my application "domain name either does not exist or could not be contacted". Any help from any one who have come across this error? Please reply soon and save my life.....

Question by:maheejas
    LVL 20

    Expert Comment

    I guess this is about the same problem in the other question. So here it is my suggestion:

    An LDAP ADsPath would have the following format:


    The "HostName" can be a computer name, an IP address or also can be a NETBIOS name or short DNS name. If your LDAP ADsPath looks like this:


    First thing to do is to ping to the machine name from a client workstation machine, or anywhere on which your code is running. Then by default LDAP uses port number 389 even if you don't explicitly set in the path. So second thing to do is to telnet from the remote machine to your active directory server.

    telnet machine01 389

    Let me know what's the result.

    Author Comment

    Hi Henry,

    I did that. And nothing happened. I first typed in the command prompt "ping (and the machine name where AD is setup)".
    It brought me up the IPaddress etc. And second, I typed "telnet (machine name where AD is setup) 389. It opened me up a new command window with just one line prompt c:/documents and settings. That's all. Why did ask me to do that. Is it a way to find the path to active directory?

    Thanks, Please reply,
    LVL 20

    Expert Comment

    What I know is that you just finished setup your win2k3 box, and a fresh installation of win2k3 doesn't open almost known port number. That might be the reason your binding to AD to fail. But if pinging causes the win2k3 echoes back with its ip addresses and telneting brought you to a blank command prompt window, that means you're good to go.

    Author Comment

    Actually, right now the application is on development machine. Let's say, it is my local machine. And I am contacting a server which has Windows 2000 Server(not 2003) to access AD. It is setup on that. There are no firewalls inbetween. And my machine is part of network.

    So, when I run the application from my machine, the first thing it does is contacting the server that has AD. So, based upon the error, I think it is not able to locate the server. In that case, I got doubt whether I am giving right path to AD. I am not sure how far I am right.

    Or, as I am trying to access AD to check the credentials of the user, are there any other specific settings(security) need to be taken care of on my machine and also on my IIS?
    Thanks for all your help, I am not a network person, and so, I don't understand lot of these things. Please don't mind if any of my concerns or questions look novice to you. Please reply,
    LVL 20

    Accepted Solution

    It is weird...I didn't get email notification from you last reply. Anyway, about your problem, I don't know how it is going right now. But assuming your AD site/subnet is defined correctly, this is how System.DirectoryServices APIs handles user credentials and use it as security context.

    If you login to the domain via a client machine, IIS anonymous access is enabled, and impersonation set to false. Your web application will be running under aspnet user account. With the same settings but impersonation is set to true, IUSR_MACHINE user account will be used in the security context. In return, binding process without explicitly specifying user name and password will fail as none of aspnet or IUSR_MACHINE user account has privilege to access to AD.

    But you should be able to run the following code:
       Dim de As New DirectoryEntry()
       de.Path = "LDAP://<server_name>/rootDSE"
       de.Username = "myDomain\user1".
       de.Password = "xxxxxxx"
       Dim dnsHost as String = de.Properties("defaultNamingContext").Value

    Server name in the above ldap path is optional, that means you can perform serverless binding and specify the ldap path to just:
       de.Path = "LDAP://rootDSE"
    but that only works if you're in the domain.

    And if you're outside domain, the <server_name> is then required in the ldap path. You can set it to AD machine name, ip address or AD domain dns name. And user name and password is also required to be specified like shown in the code above.

    Hope that could help you

    Author Comment

    Hi ihenry,

    Actually, I could figure out the problem. In the context of creating a "least privileged user account", everywhere it is said simply to create but no where it is specified in detail like how. I tried to create an administrator account in IIS which is present in AD also, and now the machine is talking to AD as administrator. So, it is able to work and also pulling all the groups that user belongs to.

    But, still, I appreciate your active effort and thank you a lot for helping me. Your answers still helped me in leading to the point that I could get the solution.
    ***Points are yours.*** Thanks and see you again for any other challenge that I come across.

    Good luck,

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Email Body 4 33
    Refactor procedural algorithm to OOP 3 35
    Export Dataset to Excel xlsx 8 56
    reading json from C# REST service 1 29
    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now