Alert user when their session is about to expire

Note: Cross posted from Vijay Kodali's Blog.
Permalink

Here is a quick and dirty trick to alert users on session timeout. This is not a perfect solution. But it will give reader an idea to work on...

Some facts before we start:

Session doesn't end

  • When the user closes his browser
  • When the user navigates away from your page
  • When user connection lost.

Session ends, when the server hasn't gotten a request from the user in a specific time (Session timeout value)....Permalink

Published Friday, May 21, 2010 10:07 AM by budugu
Filed under: ,

Comments

# Alert user when their session is about to expire | OOP - Object Oriented Programing

Pingback from  Alert user when their session is about to expire | OOP - Object Oriented Programing

# re: Alert user when their session is about to expire

Tuesday, December 07, 2010 3:15 PM by shahanamika83

Hi..

My button does not work in panel...

It does not get triggered.

can you help me with it..

Here is code..

<cc1:ModalPopupExtender ID="mpe_alert" runat="server"  TargetControlID="pnlAlert"

        OnOkScript="onOK" PopupControlID="pnlAlert" BehaviorID="mpe_alert">

      </cc1:ModalPopupExtender>

      <asp:Panel style='display: none' ID='pnlAlert' runat='server'>

    <table  style='height:100px;background-color:#ffffff;' cellspacing='0' cellpadding='0' width='340' border='0' >

      <tbody>

      <tr>

               <td  style='width: 200px; color:#ffffff; height:20px; background-color:#003366'>

                                       Security Warning

               </td>

      </tr>

      <tr>

               <td>

               </td>

      </tr>

      <tr align="center">

               <td>

                   Your login session is about to expire.Do you want to extend it?

               </td>

      </tr>

      <tr>

               <td>

                   <table cellpadding="0" cellspacing="0" width="100%" border="0">

                    <tr align="center">

                       <td>

                       <a href="../AdminLogin.aspx" >Logout</a>

                       <asp:Button ID="btnOK" runat="server" Text="Continue" OnClick="btnContinue_Click" />

                       <asp:Button ID="btnCancel" runat="server" Text="Logout" OnClick="btnLogout_Click" />

                       </td>

                    </tr>

                   </table>

               </td>

      </tr>

      </tbody>

      </table>

      </asp:Panel>

      I want to extend session when user clicks continue button and want to logout when user clicks logout..

# re: Alert user when their session is about to expire

Friday, April 27, 2012 7:04 AM by amit.jain

This code only works for fix timeout value , what about sliding expiration ?

Leave a Comment

(required) 
(required) 
(optional)
(required)