title: Who sets the IsAuthenticated property of the HttpContext.User.Identity
body: <p>This code is from the asp.net mvc RTM source code</p>
  
  <p>Who sets the IsAuthenticated property of the HttpContext.User.Identity ?</p>
  
  <pre><code>   protected virtual bool AuthorizeCore(HttpContextBase httpContext) {
          if (httpContext == null) {
              throw new ArgumentNullException("httpContext");
          }
  
          IPrincipal user = httpContext.User;
          if (!user.Identity.IsAuthenticated) {
              return false;
          }
      }
  </code></pre>
  
  <p>Is the IsAuthenticated property set by calling the method (asp.net mvc 4.0 sample project):</p>
  
  <pre><code>FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
  </code></pre>
  
  <p>When I debug the code of the <strong>LogOn</strong> method of the asp.net mvc 4.0 sample project after the above FormsAuth... method call. The execution of</p>
  
  <pre><code>User.Identity.IsAuthenticated
  </code></pre>
  
  <p>is still returning FALSE. Only when I debug the <strong>LogOff</strong> method the </p>
  
  <pre><code>User.Identity.IsAuthenticated
  </code></pre>
  
  <p>says TRUE. So who is setting this property to TRUE and WHEN ?</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>This is about <strong>FORMS</strong> authentication!</p>
  
  <p>I did now debug the LogOn method of the asp.net mvc sample project and after the LogOn action is returned my AuthorizeCore method I have overridden is called and then the IsAuthenticated property is TRUE!</p>
  
  <p>Does setting of TRUE depend maybe of the ModelState.Value.Error collections ?</p>
  
  <p>If count == 0 in the error collections the IsAuthenticated is TRUE
  else the IsAuthenticated is FALSE</p>
  
  <p>Can you confirm that?</p>