Hi,
I have found some sample code for accessing active directory using the
LDAP provider to check a user's credentials. The sample looks good
but I do not understand the point of two lines.
public bool AuthenticateUser(string domain, string username, string2.
password)
{
string domainAndUsername = domain + @"\" + username;
DirectoryEntry entry = new DirectoryEntry( LDAPPATH,
domainAndUsername, password);
try
{
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;
}
LDAPPATH = result.Path;
}
catch (Exception ex)
{
throw new Exception("Error authenticating user." + ex.Message);
}
return true;
}
Can someone tell me what are the lines;
Object obj = entry.NativeObject;
and
LDAPPATH = result.Path;
are for?
Thanks,
Chandy