title: Session timeout - how to make "remember me" properly?
body: <p>The code (in global.asax):</p>
  
  <pre><code>void Session_Start(object sender, EventArgs e)
  {
      // remember me
      HttpCookie rememberCookie = HttpContext.Current.Request.Cookies["remember"];
      if (rememberCookie != null)
      {
          if (rememberCookie.Value == "true")
              HttpContext.Current.Session.Timeout = 464800;
          else
              HttpContext.Current.Session.Timeout = 70;
      }
      else
          HttpContext.Current.Session.Timeout = 60;
  }
  </code></pre>
  
  <p>Basicly, i want to make "remember me" using session and cookie.
  This is the code, when login in the home.aspx.cs</p>
  
  <pre><code>public void _loginFrmSubmit(object sender, EventArgs e)
  {
      Session["User"] = home_username.Text;
      HttpCookie rememberCookie;
      //rememberCookie.HttpOnly = true;
      if (remember.Checked)
      {
          rememberCookie = new HttpCookie("remember", "true");
          rememberCookie.Expires = DateTime.Now.AddMonths(12);
      }
      else
      {
          rememberCookie = new HttpCookie("remember", "false");
          rememberCookie.Expires = DateTime.Now.AddDays(1);
      }
      HttpContext.Current.Response.Cookies.Add(rememberCookie);
      Response.Redirect(Request.RawUrl);
  }
  </code></pre>
  
  <p>The code working fine when first fired. But after I log out:</p>
  
  <pre><code>public void _Quit(object sender, EventArgs e)
  {
      HttpCookie rememberCookie = new HttpCookie("remember");
      rememberCookie.Expires = DateTime.Now.AddDays(-1);
      Response.Cookies.Add(rememberCookie);
      Session.Clear();
      Response.Redirect(Request.RawUrl);
  }
  </code></pre>
  
  <p>And I login again. The session.timeout is not changing. It get stuck with the first timeout set. Please help me make that everytime i logout, and login, the session timeout changes.</p>