Re: NTLM authentication
- From: "Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx>
- Date: Thu, 4 Jan 2007 13:00:04 +0100
"Mark Rae" <mark@xxxxxxxxxxxxxxxxx> wrote in message news:%23KJnvM$LHHA.3952@xxxxxxxxxxxxxxxxxxxxxxx
"webrod" <rodolphe.aoustin@xxxxxxxxx> wrote in message news:1167909149.759083.317590@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Actually, I have users who belong to a domain (WinNT).
So I have users in the SAM database.
Now what I want is to check that a user really exists in this DB with a
.NET script.
So I would like a way to query the SAM database OR to bind the SAM
database.
Is *that* all you want to do...? I.e. validate a login and password...?
Why don't you just do this:
using System.DirectoryServices;
public static bool Logon(string pstrDomain, string pstrUser, string pstrPassword)
{
try
{
using (DirectoryEntry objADEntry = new DirectoryEntry("LDAP://" + pstrDomain, pstrUser, pstrPassword))
{
return !objADEntry.NativeObject.Equals(null);
}
}
catch (System.Runtime.InteropServices.COMException)
{
return false;
}
catch (Exception)
{
throw;
}
}
Won't work, the OP is in a Windows NT4 domain not an ActiveDirectory domain, there is no LDAP server on the DC. Also, using above (DirectoryServices aka. ActiveDirectory) to authenticate a windows user is bad practice, I keep saying this.
Willy.
.
- Follow-Ups:
- Re: NTLM authentication
- From: Mark Rae
- Re: NTLM authentication
- References:
- NTLM authentication
- From: webrod
- Re: NTLM authentication
- From: Willy Denoyette [MVP]
- Re: NTLM authentication
- From: webrod
- Re: NTLM authentication
- From: Willy Denoyette [MVP]
- Re: NTLM authentication
- From: webrod
- Re: NTLM authentication
- From: Mark Rae
- NTLM authentication
- Prev by Date: Re: NTLM authentication
- Next by Date: Re: Stopping application crashing when there is an unhandled exception
- Previous by thread: Re: NTLM authentication
- Next by thread: Re: NTLM authentication
- Index(es):