Click here to Skip to main content
15,887,975 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
How to know that AD exists?

I have only ip address. I tried to use those methods:

C#
if(DirectoryEntry.Exists("LDAP://192.168.1.1"))

also

C#
DirectoryEntry directoryEntry = new DirectoryEntry("LDAP://192.168.1.1")

but it didn't help. I use LdapConnection right now, but I have a problem

C#
LdapConnection connection = new LdapConnection(new LdapDirectoryIdentifier("192.168.1.1"));
                        connection.AuthType = AuthType.Basic;
                        NetworkCredential credential =
        new NetworkCredential("a", '1");

                        connection.Credential = credential;

                        connection.Timeout = new TimeSpan(1000);
                        connection.Bind();

I'm getting 81 code and The LDAP unavailable.

Does somebody know is possible just to know is ip is correct and AD exists?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900