Sometimes simply knowing
who you are can help a great deal. I just figured out some tricky Active Directory permission issues by tracing out the current WindowsIdentity, like so:
string strCurrentID = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
System.Diagnostics.Trace.WriteLine("Current Impersonated Identity: " + strCurrentID );
Anyhow, I kept getting Unknown error (0x80005000). Problem was, the current user didn't have the proper permissions to our AD store. From an ASP.NET application, this user is: NT AUTHORITY\NETWORK SERVICE. I changed this to a more trusted account, by changing the anonymous user and password in the “Authentication Methods“ tab in the Directory Security tab of the site properties but I then remembered that I also had to adding the following to my web.config file.
<identity impersonate="true"/>
Problem solved.
-Brendan