title: Check who a WinForm is running as
body: <p>I'm working on a project where I need to open a winform from a web service.  I am not sure what the winform is opening as(my user account, a system account, aspnet, etc.) and I want to know if there is a way to check when I execute the following code:</p>
  
  <pre><code>namespace.Form2 form2 = new namespace.Form2();
  
  System.Windows.Forms.Application.Run(form2);
  </code></pre>
  
  <p>I would prefer a way to see what account is being used when I call Application.Run, but if anyone knows which account is used by default that would be helpful as well.</p>
  
  <p>Something as simple as this would suffice :</p>
  
  <pre><code>MessageBox.Show("form2 running as: " + Thread.CurrentPrincipal.Identity.Name);
  </code></pre>
  
  <p>I think when I call Application.Run it starts a new process though, and doesn't run under this same identity.  Credential passing is crucial to making this work, so it has to run as the right account (the same one that appears when I run the above code).</p>