Hello,
I'm trying to create a ASP page that allows a user to changer her/his windows password online. I found this code somewhere on the net (it is not mine). I am getting the following error:
Active Directory (0x80070005)
General access denied error
/changePass.asp, line 85
(same error occurs on both lines)
PassAge = User.Get("PasswordAge")/86
400
Call User.ChangePassword(OldPas
sword, NewPassword)
I realize that this error is because the user who logs in is not an administrator. Is there a security setting somewhere that I can change to allow this script to run, or is there a way to allow this asp page to act as an administrator without making the user an administrator, or could I create a dll file that somehow has admin privileges?
Thanks,
code is below
ff
'=========================
==========
==========
=========
Dim User
Dim UserName
Dim UserDomain
Dim Domain
Dim MaxAge
Dim MinLength 'password length
Dim MaxLength 'password length
MaxLength = 14
UserDomain = "myDomain"
Set Domain = GetObject("WinNT://" & UserDomain)
UserName = "username"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
MinLength = Domain.MinPasswordLength
MaxAge = Domain.MaxPasswordAge / 86400
IF MaxAge < 0 THEN
MaxAge = "Onbeperkt"
Expire = "Verloopt niet"
ELSE
PassAge = User.Get("PasswordAge")/86
400
Expire = MaxAge - PassAge & " dagen"
MaxAge = MaxAge & " dagen"
END IF
Dim NewPassword
Dim OldPassword
NewPassword = "newPass"
OldPassword = "oldPass"
Call User.ChangePassword(OldPas
sword, NewPassword)
If (Err.Number<>0) Then
err_number = Hex(Err.Number)
IF err_number = "8007005" THEN
err_text = "Your Account is locked out."
END IF
IF err_number = "80070056" THEN
err_text = "Invalid Old NT Password."
END IF
IF err_number = "800708AD" THEN
err_text = "The specified NT Account does not exist."
END IF
IF err_number = "800708C5" THEN
err_text = "Your new password cannot be the same as any of your previous passwords."
END IF
%>
"An error has occurred. " number = <%=err_number%><BR><%=err_
text%><BR>
<%=Err.Num
ber%>
<%
End If
Start Free Trial