active directory and asp.net error

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default active directory and asp.net error

    I'm getting the following error exception when using the code below.

    I've seen a number of people post the same problem. Many of the solutions
    say to use impersonate=true in web.config, or update machine.config to
    specify the username and password in the processmodel element, or to use
    delegation, but they've all said you don't need to do those things if you
    specify a username and password in the DirectoryEntry constructor... which
    is what i'm doing.

    This works fine on my local webserver, but as soon as i publish it to
    another webserver it throws an exception. Does anybody have any other
    suggestions? By the way, i'm using Visual Studio .NET 2003.

    thanks.

    Unknown error (0x80005000)
    at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail)
    at System.DirectoryServices.DirectoryEntry.Bind()
    at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
    at System.DirectoryServices.PropertyValueCollection.P opulateList()
    at System.DirectoryServices.PropertyCollection.get_It em(String propertyName)


    -------------

    DirectoryEntry root = new DirectoryEntry(LDAP://my_domain,
    "my_domain\\some_domain_user", "password");
    DirectorySearcher searcher = new DirectorySearcher(root);
    searcher.Filter = "(&(objectClass=user)(sAMAccountName=some_domain_u ser))";
    SearchResult searchResult = searcher.FindOne();
    DirectoryEntry entry = searchResult.GetDirectoryEntry();
    object o = entry.Properties["givenname"].Value; // exeception occurs here
    />


    Jamie Guest

  2. Similar Questions and Discussions

    1. Active Directory Search fails ("The directory service is unavailab
      Hi all, I'm having one of those nerve wrecking errors, when trying to perform a simple search in an Active Directory. The objective of the code...
    2. Asp.net and Active Directory Log On To
      Hello, I use Active Directory to authenticate users in my Asp.Net web applications. The problem I'm having is that the user's account are set to...
    3. Unable to read Active Directory data from a web part - Unknown error (0x80005000)
      I've read a number of other postings trying to deal with this problem, but none of the suggestions worked. I developed a SharePoint 2003 portal...
    4. Active Directory and ASP
      Hey All, This is the senerio: I have 2 domains lets call them "workingdomain.com" and "activedirectorydomain.com". I have an account on the...
    5. ASP ERROR: error '8002801d' -> Library not registered. : my Active Server Pages are not so active.
      I've got two IIS servers. One public and one staging. On the public server the ASP code works fine however on the staging server I've started...
  3. #2

    Default RE: active directory and asp.net error

    Hi Jamie,

    An ASP.NET application need proper permission to create a DirectoryEntry
    object. For example, before a DirectoryEntry object is created, it may need
    to read some system file or registry value. This do nothing with the
    account you sepcify in following line.

    DirectoryEntry root = new DirectoryEntry(LDAP://my_domain,
    "my_domain\\some_domain_user", "password");

    "my_domain\\some_domain_user" is used when AD authenticating the client. I
    believe you still need to impersonate in your ASP.NET application to get
    proper permission.

    Hope this help,

    Luke
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    MSFT Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139