Jquery Redirect inmediatly after Session Timeout
<p>I have a web in ASP.NET MVC and I want to redirect to login page automatically after session timeout without the user intervention. For example like gmail does.</p>

<p>Now I'm doing ajax calls to the controller to check session in intervals of 5 seconds.</p>

<pre><code>[HttpPost]
        public JsonResult CheckSession(string currentUrl)
        {
            bool result = false;
            Uri url = new Uri(currentUrl);
            if (PublicUrl.Contains(url.AbsolutePath))
            {
                result = true;
            }
            else
            {
                result = HttpContext.User.Identity.IsAuthenticated;
            }
            return Json(result);
        }
</code></pre>

<p>And if the result is false I do a redirect on JQuery. </p>

<p>This works well if I manually delete the cookies on the browser. But the problem is that the session never expires because I'm doing calls to server each 5 seconds so the session timeout resets on every server side call.</p>

<p>How can I redirect on Session expiry automatically?</p>