ADSI Authentication from Visual Basic
From: Jim Dahrouge (Jim.Dahrouge@McKesson.COM)
Date: 02/13/03
- Next message: Marlon Brown: "Why do I need to protect my user accounts ?"
- Previous message: Juan: "Re: virus jdbgmgr.exe"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Jim Dahrouge" <Jim.Dahrouge@McKesson.COM> Date: Thu, 13 Feb 2003 06:33:53 -0800
In simple terms, in a VB app, I'm prompting for a Domain,
Username, and Password from a user and I want to verify
that the information entered relates to a valid user
and "authenticate" them.
I'm trying to do so as follows (based off of an MSDN
article):
Dim dso As IADsOpenDSObject
Dim domain As IADsDomain
Dim szUsername As String
Dim szPassword As String
Dim szDomain As String
On Error GoTo Cleanup
szDomain = "DOMAIN NAME" ' Validate against Domain
' szDomain = "LOCAL MACHINE NAME" 'Validate against
local machine.
szUsername = "USERNAME"
szPassword = "PASSWORD"
Set dso = GetObject("WinNT:")
Set domain = dso.OpenDSObject("WinNT://" + szDomain,
szUsername, szPassword, ADS_SECURE_AUTHENTICATION)
Cleanup:
If (Err.Number <> 0) Then
MsgBox ("An error has occurred. " & Err.Number)
End If
Set dso = Nothing
Set domain = Nothing
Notes:
1) This code works fine when I authenticate against a
domain.
2) When I try to authenticate a local user, I set the
szDomain to the local machine name and I continually get
RTE 13 (Type Mismatch).
- Next message: Marlon Brown: "Why do I need to protect my user accounts ?"
- Previous message: Juan: "Re: virus jdbgmgr.exe"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|