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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

First Post:) LDAP query works on Local Server but not when deployed t

Status
Not open for further replies.

4programming

Programmer
Sep 14, 2007
10
CA
Hello professionals,

I am in need of assistance with Active Directory and ASP and IIS. I have the following piece of code:

Code:
UserName= instr(Session("User"),"\") 
userSession = Mid(Session("User"), UserName+ 1, len(Session("User"))- UserName) 

Set objConnection = CreateObject("ADODB.Connection") 
Set objCommand =   CreateObject("ADODB.Command") 

objConnection.Provider = "ADsDSOObject" 
objConnection.Open "Active Directory Provider" 
Set objCommand.ActiveConnection = objConnection 

'objCommand.Properties("Page Size") = 1 

'objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 

objCommand.CommandText = _ 

"SELECT GivenName, mail, title FROM 'Hidden' WHERE sAMAccountName ='" & userSession & "'" 

Set objRecordSet = objCommand.Execute 
[code] 

The code is being developed locally so when I run this on my localhost it works great. On my localhost I am using Windows XP Professional and IIS 5.  When this gets deployed to the web server(II6) so that my entire company can use it, this code does not work.  What I mean by when I say it does not work is I do not get an error but rather my form text elements, GivenName, Mail and Title, do not get populated on the form with the Active directory query.  If I 

[code] 
response.write usersession

I do get a Windows NT account name as expected. So I know the code works. I am using a virtual directory and using Integrate windows authentication as my security. Please help with this. Thank you.
 
So the Session variable is working but the LDAP query is not...

The first guess is that the web server is running your ASP in the security context of its local IUSR_<ServerName> account and this account, being local to the server, does not have permission to query the AD.

What happens if, on the web server, you disable anonymous access for this ASP?
 
THANKS SHECO FOR HELPING ME OUT. ON THE VIRTUAL DIRECTORY OF THE WEB SERVER, UNDER PROPERTIES-AUTHENTICATION METHODS, THE ONLY THING THAT IS CHECKED IS INTEGRATED WINDOWS AUTHENTICATION. Anonymous access HAS NO CHECK MARK IN THE BOX.
THANKS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top