我有一个用Classic ASP编写的系统,它从表单中读取数据并更新AD。但是,当我尝试更新自己的信息时,我收到以下错误:
Active Directory错误' 80070005'
一般访问被拒绝错误
/activedirectory/index.asp,第99行
第99行
objUser.SetInfo
,整个代码块如下:
<%
uname = request.querystring("account_name")
ADUser = "LDAP://OU=Staff,OU=Users,DC=example,DC=internal"
Set objCon = Server.CreateObject("ADODB.Connection")
objCon.provider ="ADsDSOObject"
objCon.Properties("User ID") = "NETWORK\example"
objCon.Properties("Password") = "PaSsWoRd"
objCon.Properties("Encrypt Password") = TRUE
objCon.open "Active Directory Provider"
Set objCom = CreateObject("ADODB.Command")
Set objCom.ActiveConnection = objCon
objCom.CommandText ="select distinguishedName FROM '"+ ADUser +"' where sAMAccountname='"& uname &"'"
Set objRS = objCom.Execute
distinguishedName = objRS.Fields("distinguishedName")
'Const ADS_PROPERTY_UPDATE = 2
Set objUser = GetObject _
("LDAP://" & distinguishedName)
objUser.Put "givenName", firstname
objUser.Put "mail", email
objUser.Put "sn", lastname
objUser.Put "mobile", mobile
objUser.Put "description", description
objUser.Put "telephoneNumber", telephonenumber
objUser.Put "department", department
objUser.Put "title", title
objUser.Put "company", company
objUser.SetInfo
Response.Write("User data for "& uname &" has been modified. Click <a href='/'>here</a> to go home")
%>
我已经完成了我能想到的故障排除步骤,确保我使用的密码是正确的,确保帐户已授予写入权限等。一些指针将非常感激