title: how to force redirect to home page if inactive in jquery mvc application
body: <p>I have asp.net mvc application,i want to force automatic logout when user idle for 20 min.
  Also if user is moving mouse on the browser i want to retain his session timeout.
  For this i had written code as </p>
  
  <pre><code>&lt;body onload="StartTimers();" onmousemove="ResetTimers();"&gt;
  &lt;/body&gt;
  &lt;script type="text/javascript"&gt;
  
      var timoutNow = @Session.Timeout*60000; // Timeout in 2 mins.
  
          var timeoutTimer;
  
          // Start timers.
          function StartTimers() {
           //   warningTimer = setTimeout("IdleWarning()", timoutWarning);
               setTimeout("IdleTimeout()", timoutNow);
              $.get("@Url.Action("ResetSession", "Home")", function () {
                //  debugger
                  timoutNow = @Session.Timeout*60000; // Timeout in 2 mins.
                //  debugger
  
                   setTimeout("IdleTimeout()", timoutNow);
              });          
          }
  
          // Reset timers.
          function ResetTimers() {
  
              clearTimeout(timeoutTimer);
              StartTimers();
  
          }
  
  
          // Logout the user.
          function IdleTimeout() {
  
                  window.location =path + "/Home/Logout" + window.location.search;
  
          }
  &lt;/script&gt;
  </code></pre>
  
  <p>Server side :</p>
  
  <pre><code> public void ResetSession()
          {
  
              Session.Timeout = 1;
  
          }
  </code></pre>
  
  <p>But the problem is that even if user continuously moving mouse in browser ,it redirect to logout after given time.</p>