469,327 Members | 1,315 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

Get user details ASP/LDAP/WINNT

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.

Jul 22 '05 #1
2 8911
On Fri, 11 Mar 2005 04:33:02 -0800, A Lake
<AL***@discussions.microsoft.com> wrote:
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
Jul 22 '05 #2
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?

"Jeff Cochran" <je*********@zina.com> wrote in message
news:42****************@msnews.microsoft.com...
On Fri, 11 Mar 2005 04:33:02 -0800, A Lake
<AL***@discussions.microsoft.com> wrote:
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

Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by RCIC | last post: by
1 post views Thread by elziko | last post: by
1 post views Thread by Bjorn Kristensen | last post: by
3 posts views Thread by Philip Carnstam | last post: by
4 posts views Thread by Cleyton | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.