Iis ASP经典active directory查询权限问题。ASP错误80072020
我有一个ASP经典intranet站点,运行在Windows 2003和IIS 6上。在你问为什么它是一个网站之前,我继承了这个网站,目前无法更改。我正在尝试转换网站的一部分,该部分对旧数据库进行查找,而旧数据库需要转到AD中查找用户,并根据用户是否是安全组的成员授予权限。我的代码使用VBscript在广告中搜索用户并获取他们的组成员资格。我遇到的问题似乎是IIS中阻止我的双跳或权限问题。这是我的密码:Iis ASP经典active directory查询权限问题。ASP错误80072020,iis,asp-classic,active-directory,kerberos,Iis,Asp Classic,Active Directory,Kerberos,我有一个ASP经典intranet站点,运行在Windows 2003和IIS 6上。在你问为什么它是一个网站之前,我继承了这个网站,目前无法更改。我正在尝试转换网站的一部分,该部分对旧数据库进行查找,而旧数据库需要转到AD中查找用户,并根据用户是否是安全组的成员授予权限。我的代码使用VBscript在广告中搜索用户并获取他们的组成员资格。我遇到的问题似乎是IIS中阻止我的双跳或权限问题。这是我的密码: <% Dim sLogonUser : sLogonUser = Request.Se
<%
Dim sLogonUser : sLogonUser = Request.ServerVariables("Logon_User")
Dim sDomain : sDomain = Mid(sLogonUser, 1, Instr(1, sLogonUser, "\") - 1)
Dim sLogonName : sLogonName = Mid(sLogonUser, Instr(1, sLogonUser, "\") + 1)
response.write sDomain
response.write sLogonName
' Create ADO connection to Active Directory
'
Dim oConnection
Set oConnection = CreateObject("ADODB.Connection")
With oConnection
.Provider = "ADsDSOObject"
.Mode = "1" 'Read
.Properties("Encrypt Password") = True
.Open "Active Directory Provider"
End With
' Create command to search user in Active Directory
'
Dim oCommand
Set oCommand = CreateObject("ADODB.Command")
oCommand.ActiveConnection = oConnection
' Build the ADsPath element of the CommandText
'
Dim oRoot
Dim oDomain
Dim sADsPath
Dim sFilter
Dim sAttribsToReturn
Dim sDepth
Dim oRS
Dim i
Dim value
Dim c_EmployeeDirectoryConnectionString
Set oRoot = GetObject("LDAP://" & sDomain & "/rootdse")
Set oDomain = GetObject("LDAP://" & sDomain & "/" & oRoot.Get("defaultNamingContext"))
sADsPath = "<" & oDomain.ADsPath & ">"
' Build the filter element of the CommandText
'
sFilter = "(&(objectCategory=Person)(objectClass=user)(sAMAccountName=" & sLogonName & "))"
' Build the returned attributes element of the CommandText
'
sAttribsToReturn = "distinguishedName,memberOf"
' Build the depth element of the CommandText
'
sDepth = "subTree"
' Assemble the CommandText
'
ocommand.CommandText = sADsPath & ";" & sFilter & ";" & sAttribsToReturn & ";" & sDepth
' Execute the query
'
Set oRS = ocommand.Execute
' Only one user should meet the criteria
'
If (oRS.RecordCount = 1) Then
' Get that user's info
'
oRS.MoveFirst
For i = 0 To oRS.Fields.Count - 1
' memberOf
'
If (oRS.Fields(i).Name = "memberOf") Then
' adVariant
'
For Each value In oRS.Fields(i).Value
if Instr(value, "testgroup") <> 0 then
response.write "member of testgroup"
End If
Next
End If
Next
End If
%>
当您运行代码时,您可以正确地获取用户信息,但当用户查找AD时,它会失败并出现错误:'80072020'/test.asp,第44行
在Web服务器上本地运行或从我的计算机远程运行时,我都会遇到错误。web服务器配置了集成的windows身份验证。匿名身份验证已关闭,并且该站点已使用作为域服务帐户运行的应用程序池标识进行设置。我对IIS了解不够,不知道问题出在哪里,但我认为我的设置有问题。如果我硬编码一个用户名并在匿名身份验证下运行,它将很好地查找该用户。向正确方向提供任何帮助或轻推都会非常棒。您是否尝试过向相关文件夹授予IUSR_machinename和IWAM_machinename完全更改权限?结果是kerberos问题。IIS站点未正确配置为使用kerberos。因此,当用户加载该页面时,它将从windows身份验证中获取他们的域登录名,并尝试将其传递给AD,因为所有用户都拥有该域的读取权限,所以他们应该能够查找组成员身份。但由于它没有使用kerberos,因此无法将凭据发送给AD进行查询 为IIS Web服务器和运行应用程序池的域帐户添加SPN,然后将服务帐户设置为受信任以进行kerberos身份验证,解决了此问题 我将此线程用作参考: 我使用这个工具来帮助我解决kerberos问题: