title: ASP.Net core custom data in authentication ticket
body: <p>
  What is the best practice in ASP.Net core to save custom authentication ticket?<br>
  In other words how to achieve the following in terms of MVC 6:</p>
  
  <pre class="lang-cs prettyprint-override"><code>    public static void SignIn(string username, bool persistent, long accountId)
      {
          const int version = 1;
          DateTime issue = DateTime.Now;
          DateTime expiration = issue.AddMonths(1);
          string data = accountId.ToString();
  
          FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(version, username, issue, expiration, persistent, data);
          HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
  
          if (persistent == true)
              cookie.Expires = expiration;
  
          HttpContext.Current.Response.Cookies.Add(cookie);
      }
  </code></pre>