title: Get user from Windows login in asp.net
body: <p>I have an internal website and I need to see who is logged onto the Windows PC so that they don't need to type their name themselves.</p>
  
  <p>I have tried:</p>
  
  <pre><code>System.Security.Principal.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>string strName = HttpContext.Current.User.Identity.Name.ToString();
  </code></pre>
  
  <p>It works on my computer but when I use it on the server it doesn't.</p>