This is a migrated thread and some comments may be shown as answers.

Ajax Requests & Session Timeout

4 Answers 736 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Arie Segev
Top achievements
Rank 1
Arie Segev asked on 24 Jul 2007, 04:25 PM
This is probably a beginner's question, but very important for me:
Is the effect of Ajax request on the session timeout  the same as a post back?
My problem is that I have a significant client side interaction + Ajax that may take longer than the session time out before the next postback occurs. If the timeout occurs the user will lose the changes that are sent back to server via ajax request.
If I need a postback to reset the session timer what would be the best approach; I thought of putting a hidden control whose only function is to generate periodical postbacks. What will be the code for that (not the code  for the timer, but the code to have only that control post back)?

Thanks much for the help,
-- Arie

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 25 Jul 2007, 01:49 PM
Hi Arie Segev,

It is pretty much the same, with the only difference that you need to add the login page into a redirect statement so that the ajax request would know what to do. This is thoroughly described in this forum thread.
As for the timer - you do not need any code. You can simply add an AjaxTimer on your page and wire up its tick event. If the timer is not within AjaxPanel or added to AjaxManager's AjaxSettings, then it would postback the whole form.

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Arie Segev
Top achievements
Rank 1
answered on 25 Jul 2007, 06:11 PM
Thanks Steve; the thread you referred me to  is very relevant to other situations I have and is very helpful, but my question was on another situation though I did not state it precisely. Let me try again.

I have a non-Ajax page with a lengthy client-side interaction; I am trying to prevent time-out rather than re-login upon ajax request (which is the case in that thread I think ).  To do that I have a timer that calls "something" every 15 minutes to reset the  server's session timeout timer.
My question has two parts:
1. if that "something" is a plain vanila XMLHttpRequest call from a js function that essentially does nothing on the server side, i.e., an http handler is invoked and my timeout prevention class does not do any real processing. Will this reset the session time out counter?
2. Instead of 1 . I add a hidden simple control, e.g. input field and wraps it with Prometheus Ajax panel. The purpose again is to have that control call back every 15 minutes to keep the session alive. So now I don't need my special js code + special http handler as in 1.
But I can't see how I can do without the client side timer to create the event that will cause the ajax panel to  do the call back. Would have been nice to have a timer method for the Ajax manager and Panel, but I can't see it in the documentation, or perhaps it can be done?

Thanks for your help,
-- Arie
0
Steve
Telerik team
answered on 26 Jul 2007, 06:27 AM
Hello Arie,

If the page is non Ajax page, then it will be handled properly by the framework as standard timeout. As I suggested in my previous reply, you can use our RadAjaxTimer to handle this situation instead of wiring up scripts for this purpose. It is not available in the Prometheus suite, but you can use the one from our ASP.NET suite which should work seamlessly.

Regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Arie Segev
Top achievements
Rank 1
answered on 27 Jul 2007, 01:10 AM
 "It is not available in the Prometheus suite, but you can use the one from our ASP.NET suite "
 o.k.,  this was my missing link since I had Prometheous Ajax in mind  (and in the code...)
Thanks, Arie.
Tags
Ajax
Asked by
Arie Segev
Top achievements
Rank 1
Answers by
Steve
Telerik team
Arie Segev
Top achievements
Rank 1
Share this question
or