M
Michael Howes
I would think this would be very, very easy but in the 50 searches
I've done I haven't found anything.
If our application requires login and that user/password be a local
windows account or more detailed, a user that has been added to the
Power Users group that is either a local account or a active directory
account how do I authenticate?
I've found code that seems to do this against Active Directory
public static bool LogonValid(string userName, string password) {
DirectoryEntry de = new DirectoryEntry(null, domain + "\\" +
userName, password);
try {
object o = de.NativeObject;
DirectorySearcher ds = new DirectorySearcher(de);
ds.Filter = "samaccountname=" + userName;
ds.PropertiesToLoad.Add("cn");
SearchResult sr = ds.FindOne();
if(sr == null) throw new Exception();
return true;
} catch {
return false;
}
}
but this doesn't work for local accounts.
how does one authenticate against local accounts in a c#/windows forms
application?
thanks
mike
I've done I haven't found anything.
If our application requires login and that user/password be a local
windows account or more detailed, a user that has been added to the
Power Users group that is either a local account or a active directory
account how do I authenticate?
I've found code that seems to do this against Active Directory
public static bool LogonValid(string userName, string password) {
DirectoryEntry de = new DirectoryEntry(null, domain + "\\" +
userName, password);
try {
object o = de.NativeObject;
DirectorySearcher ds = new DirectorySearcher(de);
ds.Filter = "samaccountname=" + userName;
ds.PropertiesToLoad.Add("cn");
SearchResult sr = ds.FindOne();
if(sr == null) throw new Exception();
return true;
} catch {
return false;
}
}
but this doesn't work for local accounts.
how does one authenticate against local accounts in a c#/windows forms
application?
thanks
mike