title: Use App Pool Identity and User that running process
body: <p>I am wanting to know is this possible or what could be a possible workaround.  I want to have my site running in IIS - the App pool that runs the site will be a Service Account that can look up AD.</p>
  
  <p>To get the current App Pool account and set up the Principal context I have the below:</p>
  
  <pre><code>string appPoolAccount = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
  // Define Context
  PrincipalContext context = new PrincipalContext(ContextType.Domain);
  </code></pre>
  
  <p>Now users will be running the site from there own machine - when they launch there browser the username that launches the process will be 'test123' as an example - as this would be there logged in user.  </p>
  
  <p>What I need to get is that userid that they are running the browser as so I can do something like below (were the second parameter will be the string of the user running the process which I have found):</p>
  
  <pre><code>UserPrincipal user = UserPrincipal.FindByIdentity(context , 'test123');
  </code></pre>
  
  <p>So far I have tried to get that user string from:</p>
  
  <pre><code>string test = Environment.UserName; //Took the App Pool Account
  WindowsIdentity wi = WindowsIdentity.GetCurrent(); // Took App Pool account
  string test = HttpContext.Current.User.Identity.Name; //bombed out as null
  </code></pre>