Accessing AD using ADSI LDAP provider in ASP

Discussion in 'ASP General' started by TomikZ, Mar 10, 2008.

  1. TomikZ

    TomikZ Guest

    I'd like to get some user account properties using .asp script. When I try
    to use ADSI WINNT provider it works fine except that I apparently cannot
    access some properties such as objUser.managedObjects. I have this simple
    code:

    <%
    Set objUser = GetObject("LDAP://CN=Users,CN=FisrtName
    LastName,DC=MyDomain,DC=com")
    For Each strValue in objUser.managedObjects
    Response.Write "This: " & strValue & "<br>"
    Next
    %>

    As a VBS script it works fine but as an ASP page I cannot get the object
    initialized. Is it problem with syntax or something else? I'd like to avoid
    using .NET Framework and ADO connection as well if possible. All I really
    need is to get list of managedObjects

    Thank you,
    TomikZ, Mar 10, 2008
    #1
    1. Advertising

  2. "TomikZ" <> wrote in message
    news:...
    > I'd like to get some user account properties using .asp script. When I try
    > to use ADSI WINNT provider it works fine except that I apparently cannot
    > access some properties such as objUser.managedObjects. I have this simple
    > code:
    >
    > <%
    > Set objUser = GetObject("LDAP://CN=Users,CN=FisrtName
    > LastName,DC=MyDomain,DC=com")
    > For Each strValue in objUser.managedObjects
    > Response.Write "This: " & strValue & "<br>"
    > Next
    > %>
    >
    > As a VBS script it works fine but as an ASP page I cannot get the object
    > initialized. Is it problem with syntax or something else? I'd like to

    avoid
    > using .NET Framework and ADO connection as well if possible. All I really
    > need is to get list of managedObjects
    >


    "I cannot get the object initialized" is hardly a good description of the
    problem you are having. Could you be a bit more specific.

    This will probably be a permission thing. The anonymous user guest account
    may not have access to what you are trying to access.

    Have you tried turning off anonymous access for the page and turning on
    integrated security.



    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Mar 10, 2008
    #2
    1. Advertising

  3. TomikZ

    TomikZ Guest

    Anthony,
    IE7.0 says "HTTP 500 Internal Server Error" and Firefox says error
    '80072020' line 13 which is
    Set objUser = GetObject("LDAP://CN=FirstName
    LastName,CN=Users,DC=mydomain,DC=com")

    When I try to catch the err value it's 424 but not when creating the objUser
    but when trying to access it
    Response.write objUser.FullName & "<br>"

    Integrated Windows Authentication is the only one enabled and in the
    Security log of the server I can see successfull logon via Kerberos with
    some Priviliges granted. Also when I try to get LOGON_USER variable, it
    contains my username and therefore I should have access to AD.

    I don't know what could be wrong
    Thank you,
    Tomas

    "Anthony Jones" <> wrote in message
    news:...
    > "TomikZ" <> wrote in message
    > news:...
    >> I'd like to get some user account properties using .asp script. When I
    >> try
    >> to use ADSI WINNT provider it works fine except that I apparently cannot
    >> access some properties such as objUser.managedObjects. I have this simple
    >> code:
    >>
    >> <%
    >> Set objUser = GetObject("LDAP://CN=Users,CN=FisrtName
    >> LastName,DC=MyDomain,DC=com")
    >> For Each strValue in objUser.managedObjects
    >> Response.Write "This: " & strValue & "<br>"
    >> Next
    >> %>
    >>
    >> As a VBS script it works fine but as an ASP page I cannot get the object
    >> initialized. Is it problem with syntax or something else? I'd like to

    > avoid
    >> using .NET Framework and ADO connection as well if possible. All I really
    >> need is to get list of managedObjects
    >>

    >
    > "I cannot get the object initialized" is hardly a good description of the
    > problem you are having. Could you be a bit more specific.
    >
    > This will probably be a permission thing. The anonymous user guest
    > account
    > may not have access to what you are trying to access.
    >
    > Have you tried turning off anonymous access for the page and turning on
    > integrated security.
    >
    >
    >
    > --
    > Anthony Jones - MVP ASP/ASP.NET
    >
    >
    TomikZ, Mar 13, 2008
    #3
  4. TomikZ wrote:
    > Anthony,
    > IE7.0 says "HTTP 500 Internal Server Error"


    Are Friendly Errors turned off?
    http://www.aspfaq.com/show.asp?id=2109

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Mar 13, 2008
    #4
  5. TomikZ

    TomikZ Guest

    It works when script is placed on a domain controller. Before it was on a
    standalone server. This helped
    http://www.eggheadcafe.com/forumarchives/adsigeneral/Jan2006/post25384349.asp

    I just don't know how to pass credentials - it looks like GetObject method
    doesn't support it. Will try OpenDSObject instead.

    Thank you for your help anyway,
    Tomas

    "Bob Barrows [MVP]" <> wrote in message
    news:...
    > TomikZ wrote:
    >> Anthony,
    >> IE7.0 says "HTTP 500 Internal Server Error"

    >
    > Are Friendly Errors turned off?
    > http://www.aspfaq.com/show.asp?id=2109
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
    TomikZ, Mar 13, 2008
    #5
    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. BS
    Replies:
    3
    Views:
    2,050
    Alvin Bruney [MVP]
    Jun 17, 2004
  2. khaja shaik

    ADSI/LDAP Query

    khaja shaik, Jul 21, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    610
    khaja shaik
    Jul 21, 2003
  3. =?Utf-8?B?UkJyYWR5?=

    LDAP / ADSI problems

    =?Utf-8?B?UkJyYWR5?=, May 4, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    509
    =?Utf-8?B?UkJyYWR5?=
    May 4, 2005
  4. sal21
    Replies:
    0
    Views:
    119
    sal21
    Jan 23, 2008
  5. Jason Wold

    using LDAP Controls in ruby-ldap

    Jason Wold, Nov 4, 2004, in forum: Ruby
    Replies:
    5
    Views:
    240
Loading...

Share This Page