Session timeout notification
A common scenario is to show a notification to inform the user that his session
is about to expire and to let him continue it if he wants. Implementing this will
require a timer and a mechanism (best - a callback, AJAX and postback will also do
the trick) to contact the server to restart the session if the user decides this.
All this is very simple to achieve with RadNotification as shown
in the demo. The demo achieves this scenario almost codeless, the additional code
is for UI labels and demonstration purposes.
Here is how to easily achieve the core functionality step-by-step:
- 1. The ShowInterval property is set to automatically show the popup
as time before session timeouts as you desire. This simple setting replaces using
any timers at all.
- 2. The Value property is set to the desired url of the page which
shows when session expires. You could of course evaluate it on the client or send
it through different techniques, even hard - code it, but this way is more elegant
and the notification takes care of sending it to the client where you can easily
extract it.
- 3. Declare a handler for the OnCallbackUpdate event (it could be
simply blank) and call the client method update() when you want
to restart the session. This will automatically perform a callback to the server
- codeless boost of performance.
- 4. If the session should not be restarted, simply use the client get_value()
method to extract the url and redirect to it.
As a conclusion, the RadNotification is a very good, almost codeless solution for this popular scenario. The same could be achieved with other popups as well, but this approach is the most straight forward one.