title: IIS impersonation returns app pool user
body: <p>I am writing an application allowing users to manage groups in Active Directory. I want to use the identity of the currently logged in user so that they do not have to log into the application. The application works without issue remotely but after deploying to the test server (Windows 2008R2 IIS6) it is attempting to use the IIS APPPOOL identity instead of mine.</p>
  
  <p>Relevant web.config settings:</p>
  
  <pre><code>&lt;authentication mode="Windows"&gt;&lt;/authentication&gt;
  &lt;identity impersonate="true" /&gt;
  </code></pre>
  
  <p>Code to check identity:</p>
  
  <pre><code>Session("Username") = ActiveDirectory.GetUsername( _
      WindowsIdentity.GetCurrent.User.Translate(GetType(NTAccount)).Value _
  )
  </code></pre>
  
  <p>ActiveDirectory is a class of helper functions and doesn't contain any impersonation logic.</p>
  
  <p>How can I get the identity of the user accessing the application and not the IIS APPPOOL user?</p>