Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Active Directory Issue - COMException 0x80072020 An operations error     occurred

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
paul.haines@wcbs.co.uk - 05 Feb 2008 10:20 GMT
I've developed an ASP.NET 2.0 website, at the place I work at, that
needs to support both web accounts and windows accounts, (via A.D. -
it's complicated so I won't bore you). Therefore I've extended the
SqlMembershipProvider to include A.D. support via custom code. The
problem I have is that, whilst it works on my local test server, when
the website's published to a 'testing' server the A.D. code doesn't
work at all.

My requirement is to find the GUID for the current user's account, (so
it can be looked up via a separate system, which I can't change). The
basic code I use to get this data is;

// See if there's a windows log-in account entry for the current user.
WindowsIdentity objWindowsIdentity = WindowsIdentity.GetCurrent();
if (objWindowsIdentity != null)
{
  // Now look it up via A.D. to find their corresponding account
there.
  //  -> First set-up the searching options to find this user.
  DirectoryEntry objParentDirEntry = new DirectoryEntry(...);
  //if (objParentDirEntry != null)
  //{
     // -> As the windows account name will be '{network}\
{username}', extract the actual name to locate.
     string strUsername = objWindowsIdentity.Name.Split('\\')[1];
     DirectorySearcher objSearcher = new
DirectorySearcher(objParentDirEntry,
String.Format("(sAMAccountName={0})", strUsername));
     SearchResult objResult = objSearcher.FindOne();
     if (objResult != null)
     {
        // -> Their A.D. information has been successfully found, so
return the results.
        pobjDirEntry = objResult.GetDirectoryEntry();
     }
  //}
}
Where the 'pobjDirEntry' is the DirectoryEntry used for finding the
GUID.

The problem is I get the following error when the search is performed:
System.Runtime.InteropServices.COMException (0x80072020): An
operations error occurred.
  at System.DirectoryServices.DirectoryEntry.Bind(Boolean
throwIfFail)
  at System.DirectoryServices.DirectoryEntry.Bind()
  at System.DirectoryServices.DirectoryEntry.get_AdsObject()
  at System.DirectoryServices.DirectorySearcher.FindAll(Boolean
findMoreThanOne)
  at System.DirectoryServices.DirectorySearcher.FindOne()
  ...

Can someone point out what I've done wrong, or a better way of
performing the above? Or simply explain why I'm getting the error, and
what I can do to fix it?
Everything I've read about the error says the search criteria is
wrong, but it works locally and the details it uses , as far as
everyone I've spoken to at my company is concerned, are correct.
Otherwise it's that the user's security isn't high enough, but no-one
says what it *should* be. Can someone explain it to me

Thanks in advance,
Paul
Dave - 06 Feb 2008 20:36 GMT
Looking at my notes on this error, I had to use a service account as follows...
entry = new DirectoryEntry(path, ServiceAccount, ServiceAccountPwd);

Also, from a posting I recieved...

"The trick here is that if the AD server is on a different machine (very
likely), you'll need to Kerberos Delegation to get this impersonation to
work.  Read these articles:
http://support.microsoft.com/default.aspx?scid=kb;en-us;329986
http://support.microsoft.com/default.aspx?scid=kb;en-us;810572"

I recall our web ops guys had to enable Kerberos or a set a "negotiate"
property since the authentication was getting dropped between servers.  I
think this is referred to as a "double-hop" as mentioned in the above
article...

I wish I could be more of a help on this but it's been awhile...



> I've developed an ASP.NET 2.0 website, at the place I work at, that
> needs to support both web accounts and windows accounts, (via A.D. -
[quoted text clipped - 59 lines]
> Thanks in advance,
> Paul

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.