Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am developing an ASP.NET website. One of its features is authenticating using active directory. At developing time, (right now) i have no access to network with a server computer. So i need to work on my windows 7 ultimate. I downloaded active directory stuffs from microsoft.
When i try to logon my website with ldap address, i get this error:
The specified domain either does not exist or could not be contacted.

To use LDAP address, i need to my windows joined to a domain, Right?
Ok, but my computer is not connected to any network or server computer. Can i define a domain for local computer? How is it?
Or maybe i am trying to login in wrong way. this is my code
bool authenticated = false;
    string server = "LDAP://";
    DirectoryEntry entry = new DirectoryEntry(server, Environment.UserDomainName + "\\" + user, password);
    /*  DirectoryEntry entry = new DirectoryEntry("LDAP://"+ Environment.UserDomainName ,user, password);
    */ //DirectoryEntry entry = new DirectoryEntry(server, user, password);
    object nativeObject = entry.NativeObject;
    authenticated = true;
catch (DirectoryServicesCOMException cex)
     //not authenticated; reason why is in cex
catch (Exception ex)
    //not authenticated due to some other exception [this is optional]
return authenticated;

The code throw exception at DirectoryEntry initializing.

Thank you!!!
Updated 22-Mar-15 23:56pm

1 solution

There is no way to install domain controller on your local (desktop) Windows...
You will have to create a virtual machine, that runs a domain controller...
Microsoft has a pre-installed virtual machine here, that you can use for such testing:[^]
Share this answer
ali_heidari_ 23-Mar-15 6:09am    
Thank you for clear answer. I install it with Vmware virtual machine, right? and i define a domain on windows server, then i connect my windows 7 to it, with vmware network adapter installed, correct?
Thank you, again!
Kornfeld Eliyahu Peter 23-Mar-15 6:18am    
You can use VirtualBox too -
And yes the rest of the process is as you declared it...
ali_heidari_ 25-Mar-15 9:48am    
I installed windows server 2008 r2 on vmware workstation. Made a domain correctly. Now can you help me how can i join my Win7 to WinServer (on wmware workstation) ? I need to set IP,and dns. but what should i enter as dns,ip? i should set ip,dns on vmware network adapters, right?

Than you

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