Login status lost after closing the browser
<p>I have a login system using FormsAuthentication that for some reason is logging me out when closing and opening the browser. Here is how I have setup my login code:</p>

<pre><code>            FormsAuthenticationTicket ticket;

                ticket = new FormsAuthenticationTicket(1, tbUsername.Text, DateTime.Now, DateTime.Now.AddYears(1), true, string.Empty, FormsAuthentication.FormsCookiePath);

            string encryptedTicket = FormsAuthentication.Encrypt(ticket);

            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
            cookie.HttpOnly = true;

            //Add the cookie to the request
            Context.Response.Cookies.Add(cookie);
</code></pre>

<p>As you can see I have set the cookie to be persistent across sessions. Here is my web.config part:</p>

<pre><code>&lt;authentication mode="Forms"&gt;
  &lt;forms slidingExpiration="false" loginUrl="~/Login.aspx" name="BOIGAUTH" defaultUrl="~/Admin/Settings.aspx"/&gt;
&lt;/authentication&gt;
</code></pre>

<p>Also, SessionState is disabled on this particular application. Anyone know what is wrong? </p>

<p>Btw leaving the application browser on for more than 2 hours kept me logged in even though I did not interact with the website. The cookie is only being lost when closing the browser.</p>
