title: How to get Identity for app pool in web api controller
body: <p>I have a web api controller, and I need to get the identity of the app pool which hosts the web application in IIS.</p>
  
  <p>I have tried</p>
  
  <pre><code>string threadName = System.Threading.Thread.CurrentPrincipal.Identity.Name;
  string username = this.User.Identity.Name;
  </code></pre>
  
  <p>But both are null. I want the name which runs the w3wp.exe such as IIS APPPOOL\DefaultAppPool or NETWORKSERVICE or whatever the app pool is configured to run as.</p>
  
  <p>Tried both with authentication=none which is the default when creating a new Wep Api project in VS2013 and also tried with Forms auth, but no luck.</p>