Here is another block that I can not get to convert. This is a class
module.
public bool IsAuthenticated (string domain, string username, string
pwd)
{
string domainAndUserna me = domain + @"\" + username;
DirectoryEntry entry = new DirectoryEntry( _path,
domainAndUserna me, pwd);
try
{
// Bind to the native AdsObject to force authentication.
Object obj = entry.NativeObj ect;
DirectorySearch er search = new DirectorySearch er(entry);
search.Filter = "(SAMAccountNam e=" + username + ")";
search.Properti esToLoad.Add("c n");
SearchResult result = search.FindOne( );
if(null == result)
{
return false;
}
// Update the new path to the user in the directory
_path = result.Path;
_filterAttribut e = (String)result. Properties["cn"][0];
}
catch (Exception ex)
{
throw new Exception("Erro r authenticating user. " + ex.Message);
}
return true;
}
}
Any help would be apperciated.
module.
public bool IsAuthenticated (string domain, string username, string
pwd)
{
string domainAndUserna me = domain + @"\" + username;
DirectoryEntry entry = new DirectoryEntry( _path,
domainAndUserna me, pwd);
try
{
// Bind to the native AdsObject to force authentication.
Object obj = entry.NativeObj ect;
DirectorySearch er search = new DirectorySearch er(entry);
search.Filter = "(SAMAccountNam e=" + username + ")";
search.Properti esToLoad.Add("c n");
SearchResult result = search.FindOne( );
if(null == result)
{
return false;
}
// Update the new path to the user in the directory
_path = result.Path;
_filterAttribut e = (String)result. Properties["cn"][0];
}
catch (Exception ex)
{
throw new Exception("Erro r authenticating user. " + ex.Message);
}
return true;
}
}
Any help would be apperciated.
Comment