Get user details ASP/LDAP/WINNT

A

A Lake

Hi,

I'm trying to get a very simple task to work. Using the users login name
(gained from IE) I want to get their full name from AD (Win 2k and 2003 AD
domain).

I'm using this ASP code on the IIS server:

usr=mid(request.ServerVariables("LOGON_USER"),8)
Set User = GetObject("WinNT://domainname/" & usr & ",user")
response.write "Name is " & User.Fullname
set usr=nothing

This code works fine when run on the server direct using wscript, but when
served by the web server I get the error:

Active Directory (0x80070005)
General access denied error

So the code is OK, but I'm obviously missing something here. I know using
LDAP queries are another way but I want to keep this very simple.

Do I need to change some permissions or is there another way to do this? The
user could be in one of several OUs in the AD.
 
J

Jeff Cochran

I'm trying to get a very simple task to work. Using the users login name
(gained from IE) I want to get their full name from AD (Win 2k and 2003 AD
domain).

I'm using this ASP code on the IIS server:

usr=mid(request.ServerVariables("LOGON_USER"),8)
Set User = GetObject("WinNT://domainname/" & usr & ",user")
response.write "Name is " & User.Fullname
set usr=nothing

This code works fine when run on the server direct using wscript, but when
served by the web server I get the error:

Active Directory (0x80070005)
General access denied error

So the code is OK, but I'm obviously missing something here. I know using
LDAP queries are another way but I want to keep this very simple.

Do I need to change some permissions or is there another way to do this? The
user could be in one of several OUs in the AD.

On the server you're running in the context of the logged in user,
likely administrator. In the web site, you're running in the context
of the anonymous user or the logged in user, likely *not*
administrator. Check permissions for whatever account you're using.

Jeff
 
A

A Lake

I've checked this but I get the same error logged in as an Domain Admin
using the web browser on a remote machine

IIS is set to only allow Windows Authentication (no anonymous logins)

Is there somewhere else I should be checking?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top