views:

24

answers:

2

I'm using AJAX.NET including update panels, web service calls, client controls etc.

In may page I include 3rd party javascript file that makes keep-alive call for limited preconfigured amount of time (say 30 min). this script is my session keeper.

every time the user have an interaction with the browser - i want to run a method in this script to reset the counter for new 30 min.

Is there a place that is prior / later to all my ajax calls where i can put this method call instead doing that everywhere dozens of times?

Thanks.

A: 

Well, you have to bind your AJAXing function to every browser event. Here is more about JS events. If you use jQuery, events will become much simplier.

But what I didn't get is why just don't make use of .NET Session class?

Chaotic_one
A: 

I'm not sure if there is a way to catch every ajax call, but the handler below will fire after every asynchronous postback(eg updatepanel)

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler)

More info here: http://msdn.microsoft.com/en-us/library/bb383810.aspx

As Chaotic_one mentioned, jQuery does have the concept of global events that fire before/after every ajax call, but I think that only refers to calls made using jQuery.

geoff