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 7659669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:21:46+00:00 2026-05-31T13:21:46+00:00

I am setting session time in web config. I also have a javascript for

  • 0

I am setting session time in web config. I also have a javascript for detecting session timeout and letting the user know.

I would like to be able to alert the user 30 sec or a min or more before session timeout with a popup and to give them the opportunity to extend it or cancel and just let it timeout. Can this be done? I have tried to use various methods on the internet but none seem to work. They all require that I download something and I don’t want to have to do that.

<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>

I am also checking for timeout in code behind and rediecting but thinking about just doing it in javascript.

protected void Page_Init(object sender, EventArgs e)
{
    CheckSession();
}


private void CheckSession()
{
    if (Session["ASP.NET_SessionId"] == null)
    {
       // Session.RemoveAll();
       Response.Redirect("Home.aspx");
    }
}
  • 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-31T13:21:47+00:00Added an answer on May 31, 2026 at 1:21 pm

    You have to essentialy have a timer at the same time limit as session; there is no way for the client to know exactly the time the session is at before expiring. That’ what I’ve done in an application.

    We do a JQuery $.get("keepalive.aspx") to make a request to an ASP.NET page, which accesses session and refreshes it, keeping the current session alive. You’d also then reset your client-side timer. This has worked well for us.

    See this post for more information.

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

Sidebar

Related Questions

I know invalidating a session by setting a time-out period in DD-web.xml file but
Weired problem! ASP.NET Session expires instantly. In my web.config I have this session settings:
After adding these settings in web.config for increasing session timeout: <sessionState mode=InProc stateConnectionString=tcpip=127.0.0.1:42424 stateNetworkTimeout=240
Site hosted via IIS 7.0 I would like to set my session time-out to
CFMX 8 Enterprise I have turned on the Use J2EE session variables setting under
In web.config, I set timeout in the sessionState to 20 minutes. According to MSDN,
I want to know about setting and un-setting the session in JSF2.0. Although following
I have read some issues related to session time out and i have changed
I'm developing an ASP.NET 3.5 WebForms application where I would like the session to
I am currently using session to hold the user ID at my web application.

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.