Display a message when the session is getting expired RRS feed

  • 问题

  • Hi to all

    I am using C# in web forms i am using session state. I got strucked in one situation.

    The Situtation is how to display Yes / No message one minute before the session is getting expired. if the end user clicks yes then the session timeout should be reassinged to default

    Thanks in advance
    2009年12月7日 7:33


  • Hi~~~
    I think one solution is that you should combine cookie and session.
    as you know,session is store in server,so the client have no idea to get notification about session expired without request.
    so you can set a cookie when a session is created, the cookie should contains the session key and expire date, then you can check through "document.cookie" to determine whether the session is going to expire in one minute.

    another solution is requesting a certain page through Ajax and the page should reponse the information about whether the session is expired or going to be expired.
    Wenn ich dich hab’,gibt es nichts, was unerträglich ist.坚持不懈!My blog~~~
    2009年12月8日 2:05