By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 769 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

System.DirectoryServices COM Exception 0x80072020

P: n/a

I've built an Employee Directory with ASP.NET app that queries Active
Directory for users and builds links with the results. What I'm seeing is
really intermittent failures to bind to the directory. I'll log into the app
twice with the same account and sometimes it works, while with others I get
the following:

System.Runtime.InteropServices.COMException (0x80072020): An operations
error occurred at System.DirectoryServices.DirectoryEntry.Bind(Boole an
throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at
System.DirectoryServices.DirectoryEntry.get_AdsObj ect() at
System.DirectoryServices.DirectorySearcher.FindAll (Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindAll () at
DirSearch.test.TestLogin() in C:\Inetpub\wwwroot\DirSearch\test.aspx.vb:line
Included below is a procedure I launch on Page.Load to try and isolate the

Sub TestLogin()
Dim strLDAPConn As String
Dim UserName As String
UserName = txtUserName.Text
Dim DirEntry As New DirectoryEntry(strLDAPConn)
Dim DirSearch As New DirectorySearcher(DirEntry)
Dim SrchResColl As SearchResultCollection
Dim SrchRes As SearchResult
Dim deSrchRes As DirectoryEntry
DirSearch.Filter = "(&(objectClass=user)(samaccountname=*" &
UserName & "*)(objectCategory=Person))"
DirSearch.Sort.PropertyName = "SN"
DirSearch.Sort.Direction = SortDirection.Ascending

SrchResColl = DirSearch.FindAll()
Catch ex As Exception
lblError.Text = ex.ToString
End Try

End Sub

I'm really confused as to why this is happening. what's more, I'll use the
same account, it'll work for a while (a few sessions), stop working, and then
subsequent sessions stop working. Am I missing a layer here? Any advice or
direction would be greatly appreciated.


Chris Frohlich
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.