title: Get Windows user credentials with windows authorization disabled in IIS
body: <p>Is it possible to grab a users windows credentials (i.e. username) without having windows authentication enabled in IIS?  With windows auth disabled the code below returns either NT AUTHORITY or IIS APPPOOL\ASP.NET v4.0 depending on if impersonation and anonymous authentication are enabled or not.</p>
  
  <pre><code>System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
  </code></pre>
  
  <p>I am converting an asp.net web application that is using forms authentication to custom authentication.  Basically if a user is connecting from outside the network I force a credential check whereas if they are connecting from within the network I would like to be able to just grab their windows username.  The internal portion works when I turn on windows authentication but I get the popup login box when testing outside of the network.  I either need to disable windows authentication for non local connections or figure out how to get the windows username with windows authentication disabled.  Any suggestions?  (The other alternative i thought of was splitting the application in two and having separate authentication modes for each but I'd like to avoid this).</p>
  
  <p>-I have also tried:</p>
  
  <pre><code>System.Web.HttpContext.Current.User.Identity.ToString();
  System.Threading.Thread.CurrentPrincipal.ToString();
  </code></pre>