Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7649259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:55:14+00:00 2026-05-31T10:55:14+00:00

I want to alert the user that the session timeout is about to expire.

  • 0

I want to alert the user that the session timeout is about to expire. I want to have a popup with an OK button and show the seconds ticking down on the popup. Can i do this with just java script?
Im OK with using C# code behind also.

Right now it detects session timeout and pops up telling them the session has expired.

<script type="text/javascript">
    var sessionTimeout = "<%= Session.Timeout %>";

    function DisplaySessionTimeout() {
        sessionTimeout = sessionTimeout - 1;

        if (sessionTimeout >= 0)
          window.setTimeout("DisplaySessionTimeout()", 60000);
        else {
            alert("Your current Session is over due to inactivity.");
        }
    }
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:55:15+00:00Added an answer on May 31, 2026 at 10:55 am

    Yes, you can do this via JavaScript. Here’s a simple counter implementation that was inspired from this StackOverflow answer I found a while back:

    function Counter(options) {
        var timer;
        var instance = this;
        var seconds = options.seconds || 10;
        var onUpdateStatus = options.onUpdateStatus || function() {};
        var onCounterEnd = options.onCounterEnd || function() {};
        var onCounterStart = options.onCounterStart || function() {};
    
        function decrementCounter() {
            onUpdateStatus(seconds);
            if (seconds === 0) {
                stopCounter();
                onCounterEnd();
                return;
            }
            seconds--;
        };
    
        function startCounter() {
            onCounterStart();
            clearInterval(timer);
            timer = 0;
            decrementCounter();
            timer = setInterval(decrementCounter, 1000);
        };
    
        function stopCounter() {
            clearInterval(timer);
        };
    
        return {
            start : function() {
                startCounter();
            },
            stop : function() {
                stopCounter();
            }
        }
    };
    

    … and an example of how to use it:

    var countdown = new Counter({
        // number of seconds to count down
        seconds: 3,
    
        onCounterStart: function () { 
            // show pop up with a message 
            ... 
        },
    
        // callback function for each second
        onUpdateStatus: function(second) {
            // change the UI that displays the seconds remaining in the timeout 
            ... 
        },
    
        // callback function for final action after countdown
        onCounterEnd: function() {
            // show message that session is over, perhaps redirect or log out 
            ... 
        }
    });
    countdown.start();
    

    Once the server is ready to alert the user, just create the timer and it’ll start counting down. You can customize what happens on each event: when timer starts, when a second ticks by, and when the countdown is done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When you want to alert a user of something once (one time notes about
I want to create a simple multiline Alert popup Alert.show(Blah\\nBlah) shows Blah\nBlah when what
I have a div that I want to appear based on user input (works),
We alert user using this javascript, now i want to add this functionality to
I have a JavaScript function code where I want to alert. function msgalert(x,y) {
I have a JavaScript function code where I want to alert. function msg(x,y) {
I have an an ajax request that looks like this, $('input.fakecheck').click(function(){ alert(deleteing....); $.ajax({ url:/search,
We are trying to develop a timeout feature in application where we want alert
I just want to alert when user hit enter key. I tried this one
I really want to prompt my user to keep the session alive, shortly before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.