Impersonation and DirectoryServices ops in .NET

Impersonation and DirectoryServices ops in .NET

Post by San » Wed, 10 Apr 2002 00:46:40



Here is what I am doing:

1.  I have a asp.net application which uses forms authentication
2.  All my users are in active directory [userId, password entered in the
login form should match userId and password in AD].
3.  I use windows logonUser call to authenticate the user.
4.  After authenticating the user, I would like to do some active directory
operations.
5.  Since my asp.net application is running under ASPNET account, I have
couple of choices to authenticate this user to do AD operations.
      Choice (1):  Impersonate as the user in AD and do AD operation.
      Choice (2):  Pass in userId, password credentials to DirectoryEntry
constructor every time.
I find that the choice (2) works, but choice (1) doesn't.  I am able to
impersonate successfully using token from LogonUser, but any calls
to add objects to AD gives me the following exception:

Unhandled Exception: System.Runtime.InteropServices.COMException
(0x80005000):Unknown error (0x80005000).

Can someone tell me what I am doing wrong?

Thanks

San

 
 
 

1. .NET and Functoid Add-ins

Anyone have success in implmenting a functoid in .NET.  I wrote a super
simple one that implements the IFunctoid interface and registered as well as
made sure it was in the MapEdit Functoids implemented categories.  When i
view the class through the OLE com obejct viewer and navigate to the mapedit
category the class shows up but doesnt browse correctly.

Also since each functoid is supposed to export a bitmap reource identified
by a Res ID and the fact that .NET managed code doesnt support resource
files.... How did you get around this???

Thanks for any help.

Bryan

2. which controller

3. Extending Schema with .NET DirectoryServices

4. More FCC Airwave Auctioning

5. Can't .NET do ADSI/LDAP/WinNT with DirectoryServices?

6. Test

7. DirectoryServices (.NET) and Exchange 5.5 on NT4

8. Is Win2K Throttling my CPU?. . . an interesting scenario

9. Using .NET DirectoryServices to access an AD Attribute

10. .NET doesn't recognize DirectoryServices namespace

11. Uploading and retrieving picture from AD using C#, ASP .NET and System.DirectoryServices

12. ADSI DirectoryServices .NET beta 2 / C# Windows 2000 Server- Pro

13. ADSI + ASP.NET (.NET Framework) System.Directoryservices