Why does my ASP.NET keep-alive logic not work?
<p>In order to ensure that my session always stays on, I created a simple stayalive.aspx page. The header of the page contains metadata to refresh the page every 5 minutes.</p>

<p>In my page-load logic, I simply set a value into session.</p>

<pre><code>protected void Page_Load(object sender, EventArgs e) {
    System.Web.HttpContext.Current.Session["Alive"] = 1;
}
</code></pre>

<p>My understanding is that as long as you keep putting a value in the session, the session will continue to stay alive. However, this does not seem to be working. I still get a session timeout in about 30 minutes.</p>

<p>I am wondering if anyone has any insight on why is not working.</p>

<p>Note that the sessionstate as well as forms authentication timeout values in web.config are set to 300 (5 hours).</p>

<p>One thought I had was, instead of setting the same value on the session, I set a different value each time:</p>

<pre><code>    System.Web.HttpContext.Current.Session["Alive"] = DateTime.Now;
</code></pre>

<p>Do you think this would help?</p>
