title: How to manually set value of HttpContext.User.Identity.IsAuthenticated
body: <p>I am creating an Asp.NET MVC 5 application. For this project, I am trying to implement a custom authentication mechanism (i don't want to use Forms Authentication / OWIN etc. external providers)</p>
  
  <p>I created a custom authorize attribute as follows:</p>
  
  <pre><code>[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
  public class myAuthorize : AuthorizeAttribute
  {
      protected override bool AuthorizeCore(HttpContextBase httpContext)
      {            
          if (!HttpContext.Current.Request.IsAuthenticated)
          {
              httpContext.Response.Redirect("~/Account/Login");
          }                            
  
          return base.AuthorizeCore(httpContext);
      }
  }
  </code></pre>
  
  <p>And in my Login action, I am trying to change the value of </p>
  
  <pre><code>HttpContext.User.Identity.IsAuthenticated
  </code></pre>
  
  <p>But it is read only and I am unable to change the value. Can I change its value manually or am I making a logical mistake.</p>