UserID and password authentication

J

Jonathan

Hello

I'm writing a VB 6.0 application on a WinXP client. Servers run Win2K. Is
there a way to take a network-logon UserID and password and authenticate it
against active directory? I would like the uses to enter the same UserID and
password for the app as they do to log in to WinXP



Thanks

Jonathan
 
S

sweevil

I know of an API to get the User ID, but not the password.

Private Declare Function GetUserName Lib "advapi32.dll" Alias
"GetUserNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long

Function NetUserName() As String

Dim lNameLen As Long
Dim rc As Long

Dim sUserName As String
sUserName = String$(254, 0)
lNameLen = 255

rc = GetUserName(sUserName, lNameLen)

If rc > 0 Then
NetUserName = Left$(sUserName, lNameLen - 1)
Else
NetUserName = vbNullString
End If

End Function
 
P

Paul Clement

¤ Hello
¤
¤ I'm writing a VB 6.0 application on a WinXP client. Servers run Win2K. Is
¤ there a way to take a network-logon UserID and password and authenticate it
¤ against active directory? I would like the uses to enter the same UserID and
¤ password for the app as they do to log in to WinXP
¤
¤

See the following:

How to validate user credentials from Visual Basic by using SSPI
http://support.microsoft.com/kb/279815


Paul
~~~~
Microsoft MVP (Visual Basic)
 
T

Tony Proctor

There is no API to get the password since it's not stored anywhere - only a
"digest" of the password. It's those digests that are compared, not the
original text as entered by the user

As far as the account name itself goes, I'd recommend using GetUserNameEx
rather than GetUserName since it returns the full account name, including
any domain name, and so avoids accidental matching of similar names

Tony Proctor
 
J

Jonathan

Hi Paul
This is exactly waht I wanted and it works perfectly. I knew it had to exist
somewhere.

Thanks
Jonathan

 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top