title: User.Identity.IsAuthenticated returns false sometimes
body: <p>Im using asp.net 4.0 and Form auth.
  To check if a user is authenticated or not, i use User.Identity.IsAuthenticated.
  Most of time it works perfect but i dont know how, sometimes it returns false even if user has auth.
  My web.config:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
      &lt;forms name=".xyz" loginUrl="~/" timeout="120" protection="All" path="/" slidingexpiration=true/&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>In global.asax:</p>
  
  <pre><code>protected void Application_AuthenticateRequest(Object sender, EventArgs e)
  {
      string cookieName = FormsAuthentication.FormsCookieName;
      HttpCookie authCookie = Context.Request.Cookies[cookieName];
  
      if (authCookie == null)
      {
          return;
      }
      FormsAuthenticationTicket authTicket = null;
      try
      {
          authTicket = FormsAuthentication.Decrypt(authCookie.Value);
      }
      catch
      {
          return;
      }
      if (authTicket == null)
      {
          return;
      }
      string[] roles = authTicket.UserData.Split(new char[] { '|' });
      FormsIdentity id = new FormsIdentity(authTicket);
      GenericPrincipal principal = new GenericPrincipal(id, roles);
  
      Context.User = principal;
  }
  </code></pre>
  
  <p>and in login page:</p>
  
  <pre><code>FormsAuthenticationTicket authTick = new FormsAuthenticationTicket(1, email.Text, DateTime.Now, DateTime.Now.AddDays(360), true, password.Text, FormsAuthentication.FormsCookiePath);
  string encriptTicket = FormsAuthentication.Encrypt(authTick);
  
  HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encriptTicket);
  authCookie.Expires = DateTime.Now.AddDays(360);
  Response.Cookies.Add(authCookie);
  </code></pre>
  
  <p>I also use ajax request in every 5 min. to keep session alive and this also reset auth timeout because slidingexpiration value.
  I don't know what is wrong with it. sometimes  same session and in same minute, it returns false for one page even if it returns true for all the other page. I never got this error but my visitors claim about that problem.</p>