Click here to Skip to main content
15,566,160 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello.
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:
C#
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
C#
bool authenticated = false;
try
{
    string server = "LDAP://real.domain.com";
    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!!!
A.H
Posted
Updated 23-Mar-15 0:56am
v2

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: http://www.microsoft.com/en-us/download/details.aspx?id=2227[^]
 
Share this answer
 
Comments
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 - http://www.macrium.com/help/v5/How_to/ImgToVHD/Create_a_virtual_machine_using_ImgToVHD.htm
And yes the rest of the process is as you declared it...
ali_heidari_ 25-Mar-15 9:48am    
Hello.
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