Get user details ASP/LDAP/WINNT

Discussion in 'ASP General' started by A Lake, Mar 11, 2005.

  1. A Lake

    A Lake Guest

    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.
     
    A Lake, Mar 11, 2005
    #1
    1. Advertising

  2. A Lake

    Jeff Cochran Guest

    On Fri, 11 Mar 2005 04:33:02 -0800, A Lake
    <> 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
     
    Jeff Cochran, Mar 11, 2005
    #2
    1. Advertising

  3. A Lake

    A Lake Guest

    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" <> wrote in message
    news:...
    > On Fri, 11 Mar 2005 04:33:02 -0800, A Lake
    > <> 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
     
    A Lake, Mar 11, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9l?=

    Show Details/Hide Details link button

    =?Utf-8?B?Sm9l?=, Mar 13, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    952
    dkode
    Mar 13, 2006
  2. Raghu Raman

    Pls Help : WINNT user/Anonymous login error in Webservices ?

    Raghu Raman, Sep 11, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    146
    Raghu Raman
    Sep 11, 2004
  3. Replies:
    2
    Views:
    142
    Ray Costanzo [MVP]
    Oct 18, 2005
  4. s_m_b

    LDAP version of winnt://.../user ?

    s_m_b, Jun 16, 2008, in forum: ASP General
    Replies:
    1
    Views:
    152
    s_m_b
    Jun 16, 2008
  5. Vijay Mehta

    How to get winnt login user properties

    Vijay Mehta, Oct 18, 2004, in forum: Javascript
    Replies:
    1
    Views:
    160
    Fred Oz
    Oct 18, 2004
Loading...

Share This Page