Notify user when session time out in asp.net

前端 未结 4 1186
南旧
南旧 2020-12-28 11:24

What is the best way to show a message to user after session is expired? By then, the user should be logged out and redirected to start page. I can use javascript to redirec

4条回答
  •  死守一世寂寞
    2020-12-28 11:51

    Usually a page will use JavaScript to keep a timer and display a pop-up or dhtml warning a minute or two before the session expires. My bank does this.

    It's very annoying though, 'cause if the user has multiple tabs open to the same site, one tab will know the session is about to expire but another tab won't, so you can get the warning even when it's not true. If you try to use an AJAX call to ask the server for a time till the session expires, you've just extended the session timeout and effectively made the session never expire as long as the browser window is open (which may not be a bad thing depending on your specific situation).

提交回复
热议问题