Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Guys,

I have workgroup machine .I have not any domain.now I want to authenticate my windows AD logins. Is it possible to authenticate Ad logins by workgroup name. for eg: my workgroupname is server09.
please if any code for achieve this task.paste here.

please help me out.

Thanks and regards
Amar
Posted
Comments
ZurdoDev 12-Nov-14 7:31am    
What code do you have so far? Where exactly are you stuck?
amar bisht 12-Nov-14 8:38am    
my code is below
string LdapPath="server09"; // server09 is workgroup name
string domainAndUsername = domain + @"\" + username;
entry = new DirectoryEntry(LdapPath, domainAndUsername, password);

try
{
entry.RefreshCache();// refreshing all attributes here
// Bind to the native AdsObject to force authentication.
// entry.AuthenticationType = AuthenticationTypes.SecureSocketsLayer;
Object obj = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + username + ")";
search.PropertiesToLoad.Add("cn");
SearchResult result = search.FindOne();
if (null == result)
{
return false;
}
// Update the new path to the user in the directory
LdapPath = result.Path;
string _filterAttribute = (String)result.Properties["cn"][0];


This Code is not working .Exception thrown by system "Server is not operational".

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