Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active Directory Query Works on IIS6, not IIS5

Status
Not open for further replies.
Dec 27, 2001
114
US
After developing for quite some time on IIS 5.1 (Windows XP)/MDAC 2.8, I started moving my webs over to a Windows 2000 Advanced Server/MDAC 2.8; however, those pages that queried Active Directory gave me the evil '80004005' error (Unknown error). I've moved a few to a 2003 Server and they work just fine.

Is there something special that needs to be setup in IIS 5.0 to allow AD queries?

Relevant Code Below:

Code:
<!-- insert file="adovbs.inc" -->
<%

Set ADConnect = Server.CreateObject("ADODB.Connection")
ADCS = "Provider=ADSDSOObject" 
ADConnect.Open ADCS

username = request.ServerVariables("LOGON_USER")
username = Mid(username, (InStr(username, "\")+1))

ADQuery = ""
ADQuery = "SELECT displayname, title, department, manager, mail, telephoneNumber, homeDrive, [URL unfurl="true"]wwwhomepage[/URL] from 'LDAP://DC=domain, dc=suffix' where sAMAccountName = '" & username & "'"
Set RS = ADConnect.Execute(ADQuery)

...

Side Notes:

1. Using windows authentication on both boxes; anonymous is disabled.

2. Verified MDAC 2.8 on Windows 2000 machine and, from what I've found on the web, that provided I specified should work. (
Any input would be greatly appreciated!

-David

---
David R. Longnecker
Web Developer
CCNA, MCSA, Network+, A+
Management Information Services
Wichita Public Schools, USD 259
 
not sure this is what you need EXACTLY but works on my intranet...good luck

<%
set strSysInfo = CreateObject("ADSystemInfo")
Set CrUser = GetObject("LDAP://" & strSysInfo.Username & "")
set WShell = CreateObject("WScript.Shell")


strFirstName = CrUser.givenName
strLastName = CrUser.sn
strEmail = CrUser.mail
%>
 
ooops...will work on a ws...not locally please disregard;-)

BSL
 
One additional observation:

I've noticed that the issue is fixed on the Windows 2000 boxes with 1) Windows 2000 Admin Pack installed and 2) a query of AD with ADUC or another tool since bootup. It's like the computer has to establish a connection before the ASP pages and see it.

Just assumptions on WHY it works... nothing concrete and I have yet to find any documentation. Any Windows 2000 server users out there experience this? I'm getting either the error stated earlier or the error of "table not found". That same code on a W2003 or WXP machine works just fine.

Any ideas would be greatly appreciated!

-David

---
David R. Longnecker
Web Developer
CCNA, MCSA, Network+, A+
Management Information Services
Wichita Public Schools, USD 259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top