Abdu_Allah
asked on
Why this code return no errors even if I entered incorrect username?
I am authenticate users on Active Directory but error number (Err.Number ) is *always* zero even if I entered incorrect username!
Here is the code that I run on XP machine:
<%Const ADS_SECURE_AUTHENTICATION = 0
Function IsAuthenticated(Domain, Username, Password)
On Error Resume Next
Dim authNamespace, authObject
Set authNamespace = GetObject("WinNT:")
Set authObject = authNamespace.OpenDSObject ("WinNT:// " & Domain, Domain & "\" & strUsername, strPassword, ADS_SECURE_AUTHENTICATION)
If Err.Number <> 0 Then
IsAuthenticated = False
Else
IsAuthenticated = True
End If
Set authNamespace = Nothing
Set authObject = Nothing
End Function
%>
Please help!
Here is the code that I run on XP machine:
<%Const ADS_SECURE_AUTHENTICATION = 0
Function IsAuthenticated(Domain, Username, Password)
On Error Resume Next
Dim authNamespace, authObject
Set authNamespace = GetObject("WinNT:")
Set authObject = authNamespace.OpenDSObject
If Err.Number <> 0 Then
IsAuthenticated = False
Else
IsAuthenticated = True
End If
Set authNamespace = Nothing
Set authObject = Nothing
End Function
%>
Please help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
https://www.experts-exchange.com/questions/21776136/How-to-determine-if-user-is-administrator-or-not-in-Active-Directory.html