title: cookie not working for remember me in asp.net
body: <p>I use this code for login in website:</p>
  
  <pre><code>var userId = User.UserId;
  var userData = userId.ToString(CultureInfo.InvariantCulture);
  var authTicket = new FormsAuthenticationTicket(1, userName, DateTime.Now, DateTime.Now.AddMinutes(30), persistanceFlag, userData, FormsAuthentication.FormsCookiePath);
  var encTicket = FormsAuthentication.Encrypt(authTicket);
  var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
  if (authTicket.IsPersistent)
       {
            cookie.Expires = DateTime.Now.AddMonths(6);
       }
  </code></pre>
  
  <p>and use machinekey in web.config and this code:</p>
  
  <pre><code>&lt;sessionState mode="InProc" timeout="20" cookieless="UseCookies" /&gt;
  &lt;httpCookies httpOnlyCookies="true" /&gt;
  &lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="~/Login.aspx" timeout="2880" cookieless="UseCookies" /&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>but remember me is not working! I check cookie in browser, .ASPXAUTH is saved and date expires is ok. but after a few minutes, asp.net not use cookies is browser and remember me not working! </p>