asapjim
2006-01-08 17:56:02 UTC
Hi, I’ve seen this problem posted many times but have yet to find a solution
or suggestion that has been of sufficient help to resolve my situation. We
have a routine on our ASP (classic) intranet site that we were using to check
if a user was a member of group. The implementation was working until we
upgraded the domain controller to windows server 2003. Now the
implementation fails.
Our ASP (classic) intranet site is running on Windows 2000 server, IIS5.
The IIS directory security settings -> Authentication Methods has Integrated
Windows Authentication selected (all other options are deselected). We tried
upgrading the web server to Windows 2003 IIS6 but it still fails.
When I execute the code sample I get the following error:
Error opening recordset -2147217865 Table does not exist.
However, the code does execute properly on my local windows 2000
professional machine running IIS5 . Can you suggest any changes to the code?
Any changes to our IIS configuration or domain controller?
Here’s a sample of the code that is failing:
<%
Dim rootDSE
Dim sObjectDN
Dim suser
Dim ors
Dim sProperties
Dim i
Dim arr
on error resume next 'for testing only to trap the error
'Get the logged on user name
sUser = LCase(Request.ServerVariables("LOGON_USER"))
if Instr(sUser, "\") > 0 then
sUser = Trim(Mid(sUser, Instr(sUser, "\") + 1))
end if
sProperties = "memberof" 'comma delimited list of fields to return
'get the root data for the connection
Set rootDSE = GetObject("LDAP://RootDSE")
if err.number <> 0 then
response.write "Error getting RootDSE " & err.number & " " &
err.description & "<br>"
response.end
end if
sObjectDN = "LDAP://" & rootDSE.Get("defaultNamingContext")
if err.number <> 0 then
response.write "Error getting default naming context " & err.number &
" " & err.description & "<br>"
response.end
end if
'set up the connection
Set oCon = Server.CreateObject("ADODB.Connection")
oCon.Provider = "ADsDSOObject"
oCon.Open "ADProvider"
if err.number <> 0 then
response.write "Error opening connection " & err.number & " " &
err.description & "<br>"
response.end
end if
'set up the command object
Set oCmd = Server.CreateObject("ADODB.Command")
Set oCmd.ActiveConnection = oCon
oCmd.CommandText = "<" & sObjectDN &
">;(&(objectCategory=user)(sAMAccountName=" & sUser & "));" & sProperties &
";subtree"
set ors = oCmd.execute
if err.number <> 0 then
'****This is where it fails
response.write "Error opening recordset " & err.number & " " &
err.description & "<br>"
response.end
end if
if isarray(ors.fields(0).value) then
if err.number <> 0 then
response.write "Error testing for members array " & err.number &
" " & err.description & "<br>"
response.end
end if
arr = ors.fields(0).value
for i = 0 to ubound(arr)
response.write arr(i)
next
end if
%>
or suggestion that has been of sufficient help to resolve my situation. We
have a routine on our ASP (classic) intranet site that we were using to check
if a user was a member of group. The implementation was working until we
upgraded the domain controller to windows server 2003. Now the
implementation fails.
Our ASP (classic) intranet site is running on Windows 2000 server, IIS5.
The IIS directory security settings -> Authentication Methods has Integrated
Windows Authentication selected (all other options are deselected). We tried
upgrading the web server to Windows 2003 IIS6 but it still fails.
When I execute the code sample I get the following error:
Error opening recordset -2147217865 Table does not exist.
However, the code does execute properly on my local windows 2000
professional machine running IIS5 . Can you suggest any changes to the code?
Any changes to our IIS configuration or domain controller?
Here’s a sample of the code that is failing:
<%
Dim rootDSE
Dim sObjectDN
Dim suser
Dim ors
Dim sProperties
Dim i
Dim arr
on error resume next 'for testing only to trap the error
'Get the logged on user name
sUser = LCase(Request.ServerVariables("LOGON_USER"))
if Instr(sUser, "\") > 0 then
sUser = Trim(Mid(sUser, Instr(sUser, "\") + 1))
end if
sProperties = "memberof" 'comma delimited list of fields to return
'get the root data for the connection
Set rootDSE = GetObject("LDAP://RootDSE")
if err.number <> 0 then
response.write "Error getting RootDSE " & err.number & " " &
err.description & "<br>"
response.end
end if
sObjectDN = "LDAP://" & rootDSE.Get("defaultNamingContext")
if err.number <> 0 then
response.write "Error getting default naming context " & err.number &
" " & err.description & "<br>"
response.end
end if
'set up the connection
Set oCon = Server.CreateObject("ADODB.Connection")
oCon.Provider = "ADsDSOObject"
oCon.Open "ADProvider"
if err.number <> 0 then
response.write "Error opening connection " & err.number & " " &
err.description & "<br>"
response.end
end if
'set up the command object
Set oCmd = Server.CreateObject("ADODB.Command")
Set oCmd.ActiveConnection = oCon
oCmd.CommandText = "<" & sObjectDN &
">;(&(objectCategory=user)(sAMAccountName=" & sUser & "));" & sProperties &
";subtree"
set ors = oCmd.execute
if err.number <> 0 then
'****This is where it fails
response.write "Error opening recordset " & err.number & " " &
err.description & "<br>"
response.end
end if
if isarray(ors.fields(0).value) then
if err.number <> 0 then
response.write "Error testing for members array " & err.number &
" " & err.description & "<br>"
response.end
end if
arr = ors.fields(0).value
for i = 0 to ubound(arr)
response.write arr(i)
next
end if
%>