sql sessionState time out vs forms authentication timeout
<p>I would like to display the "Your session has expired" on logon page if session has been idle for given 5 minutes.</p>

<p>What should the time out value be for Sql Session State and Form Authentication Time Out:</p>

<blockquote>
  <ol>
  <li>same?</li>
  <li>session state> form timeout</li>
  <li>Form time out > session time.</li>
  </ol>
</blockquote>

<p>ideally, if someone could explain the diff between above will be appreciated.</p>

<p>Currently, my code looks like below and Session["SessionID"] is not Null even after Login redirection for idle of 5 minute:</p>

<pre><code>On Session_Start()
 Session["SessionID"] = Guid.NewGuid();
</code></pre>

<p>On LogOn.cshtml:</p>

<pre><code> @{
        string sessionExpiredMsg = string.Empty;

        HttpContext ctx = HttpContext.Current;
        if (ctx.Session["SessionID"] == null)
        {
            sessionExpiredMsg = "Your session has expired. Please re-login again.";
        }
    }
@
</code></pre>

<p>On web.config:</p>

<pre><code>&lt;sessionState
timeout=5....

&lt;authentication mode="forms"
 timeout=5....
</code></pre>

<p>Thank you.</p>
