tags:

views:

53

answers:

1

I am very new to NTLM/LDAP and trying to authenticate using NTML running on a local machine. The code provided by Microsoft ( http://support.microsoft.com/kb/326340/en-us ) seems to work, I just do not know how to connect to it.

I know that the authentication service is running because Contos 8 has been set up to authenticate using NTLM and it is working. I just do not know what the "connection string" should be:

I am trying: LDAP://CN=machinename with no luck.

Dim adAuth As LdapAuthentication = New LdapAuthentication("LDAP://CN=LOCALMACHINENAME")
Dim entry As DirectoryEntry = New DirectoryEntry(_path, domainAndUsername, pwd)

Suggestions?

+1  A: 

In .NET 3.5 you can authenticate against a domain or machine using PrincipalContext.ValidateCredentials.

Dim result as Boolean
Using context As New PrincipalContext( ContextType.Machine, Nothing )
    result = context.ValidateCredentials( username, password )
End Using
Lachlan Roche
I ended up finding unmanaged code that tapped into ADVAPI32.dll. I got it to work, but your method does look cleaner.http://dotnetslackers.com/articles/aspnet/Windows-Authentication-using-Form-Authentication.aspx
Andy