Home > DeveloperSection > Forums > How to Session Timeout resetting?
ben reitman
ben reitman

Total Post:96

Posted on    October-06-2014 12:34 AM


 1 Reply(s)
 603  View(s)
Rate this:
I want to Reset Session Timeout when user is still active.

In my scenario my session timeout is 20 min., when session time is reached before 10 seconds i am showing a dialog to confirm the user as "Session is going to time out, Do you want to stay in ??". If user is click yes, i want to continue my session with again 20 minutes start from 21st minute, because as per requirement i am saving user session time in database table.

Kamlakar Singh
Kamlakar Singh

Total Post:194

Posted on    October-06-2014 12:37 AM

try this code:
write the jquery code like this:


    (document).ready(function () {




            autoOpen: false,


            resizable: false,

            modal: true,

            title: "Session Timeout",


            buttons: {

                Yes: function () {


                        url: '/<your controller>/SessionTimeout', // Redirects to action method for every 20 minutes.


                        dataType: "json",

                        type: "GET",

                        error: function () {

                            alert(" An error occurred.");


                        success: function (data) {







                Logout: function () {

                    location.href = '/<your controller>/Logout';








    function myFunction() { // Fires every 20 minutes


        setInterval(function () {



        }, 1200000);



Controller Code:

public ActionResult SessionTimeout()



            Session.Timeout = Session.Timeout + 20;


            return Json("", JsonRequestBehavior.AllowGet);


Don't want to miss updates? Please click the below button!

Follow MindStick