title: LogonUserIdentity.Name vs. User.Identity.Name
body: <p>I have an ASP.NET Web Forms Application project that is running upon the 4.0 framework. I'm very familiar with Web Applications, but not so much with Web Forms Applications. I ran into a notable difference between the two of them today, and I'm confused at why this difference even exists.</p>
  
  <p>Typically, in a Web Application, if I want to determine who the current user of the page is then I just retrieve their domain log-in from <strong>User.Identity.Name</strong>. So, I was quite perplexed when I hit F5 to run my solution (my Web <strong>Forms</strong> Application!) in my debug environment and found that the User.Identity.Name was empty. So I then googled "User.Identity.Name is empty" and ran into a wall of links that mostly all dealt with people having this problem when they hadn't disabled Anonymous Authentication in IIS. Of course, that's not my problem (I think) as I'm just debugging from Visual Studio 2012 here.</p>
  
  <p>However, I continued to dig and eventually found some obscure property on the HttpContext that is not empty and returns the user's domain log-in. The property is <strong>HttpContext.Current.Request.LogonUserIdentity.Name</strong>. Which leads me to my question...</p>
  
  <p><strong>Question</strong>: In my Web Forms Application, why is User.Identity.Name empty but HttpContext.Current.Request.LogonUserIdentity.Name is not?</p>
  
  <p>Thanks in advance for the help!</p>
  
  <p>EDIT: Forgot to state what I have in my web.config (because I'm sure it'll be asked for if I don't!).</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;system.web&gt;
    &lt;customErrors mode="Off" /&gt;
    &lt;compilation debug="true" targetFramework="4.0" /&gt;
    &lt;authentication mode="Windows"/&gt;
  &lt;/system.web&gt;
  &lt;system.webServer&gt;
      &lt;httpProtocol&gt;
        &lt;customHeaders&gt;
          &lt;clear /&gt;
          &lt;add name="X-UA-Compatible" value="IE=10,chrome=1; IE=9,chrome=1; IE=8,chrome=1; IE=edge,chrome=1" /&gt;
        &lt;/customHeaders&gt;
      &lt;/httpProtocol&gt;
      &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
      &lt;defaultDocument&gt;
        &lt;files&gt;
          &lt;add value="Home.aspx" /&gt;
        &lt;/files&gt;
      &lt;/defaultDocument&gt;
    &lt;/system.webServer&gt;
  </code></pre>
  
  <p>That's pretty much all I have in my web.config besides tags for the EntityFramework. </p>