473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Javascript w/My AJAX Callback - Why Doesn't This Work Correctly?

Hey guys, here's what I have...

To help manage browser windows with session state on the server, I
have some javascript code in one of my master pages that gets planted
into most (content) pages on my site...

<script type='text/javascript'>
var sessionTimer;
function StartSessionTimer()
{
sessionTimer =
window.setTimeout('RedirectToSessionTimedOutPage() ', 600000);
}
function RestartSessionTimer()
{
clearTimeout(sessionTimer);
StartSessionTimer();
}
function RedirectToSessionTimedOutPage()
{
window.location = '/SessionTimedOut.aspx';
}
</script>

For most pages I perform AJAX xml-http callbacks to the server with
UpdatePanels. Then I fire off the 'RestartSessionTimer' client-side
javascript function when the asynchronous call returns from the
server.

The idea is, I set up the code above to handle redirecting browsers to
the
'SessionTimedOut.aspx' page when the value of 600000 milliseconds
(ten minutes) elapses.

But when I do an AJAX callback, I must *reset* the value,
so that the redirect occurs ten minutes from *then*. I have
successfully set up the code to call the client-side
'RestartSessionTimer'
function when the callback finishes, but the value of 600000
apparently is never reset. It always retains (what is remaining) of
the original value.
An example: I load the page and then after about nine minutes (one
minute prior to the 'setTimeout' expiration,) I do actions that make
that
make the callback and that call the 'RestartSessionTimer' function in
the browser. However the page still redirects only a minute later ...
instead of in
*another* ten minutes as intended.
What am I doing wrong here?

Nov 1 '07 #1
1 2005
if you are using cookie based sessions, then update panels' xmlhttprequest do
not update the browser cookie, so after the cookie timesouts, the update
panel request will not contain the session cookie and your page will not have
session (even though the session is still alive on the server).

most likely the update panel is getting an error back, and not calling you
reset timer event.
-- bruce (sqlwork.com)
"Joey" wrote:
Hey guys, here's what I have...

To help manage browser windows with session state on the server, I
have some javascript code in one of my master pages that gets planted
into most (content) pages on my site...

<script type='text/javascript'>
var sessionTimer;
function StartSessionTimer()
{
sessionTimer =
window.setTimeout('RedirectToSessionTimedOutPage() ', 600000);
}
function RestartSessionTimer()
{
clearTimeout(sessionTimer);
StartSessionTimer();
}
function RedirectToSessionTimedOutPage()
{
window.location = '/SessionTimedOut.aspx';
}
</script>

For most pages I perform AJAX xml-http callbacks to the server with
UpdatePanels. Then I fire off the 'RestartSessionTimer' client-side
javascript function when the asynchronous call returns from the
server.

The idea is, I set up the code above to handle redirecting browsers to
the
'SessionTimedOut.aspx' page when the value of 600000 milliseconds
(ten minutes) elapses.

But when I do an AJAX callback, I must *reset* the value,
so that the redirect occurs ten minutes from *then*. I have
successfully set up the code to call the client-side
'RestartSessionTimer'
function when the callback finishes, but the value of 600000
apparently is never reset. It always retains (what is remaining) of
the original value.
An example: I load the page and then after about nine minutes (one
minute prior to the 'setTimeout' expiration,) I do actions that make
that
make the callback and that call the 'RestartSessionTimer' function in
the browser. However the page still redirects only a minute later ...
instead of in
*another* ten minutes as intended.
What am I doing wrong here?

Nov 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: NH | last post by:
Hi, I am trying to minimise postback in my web app. I have a number of inter-dependent dropdowns, an onselectedindexchange event fires for each one which obviously causes a postback. Is there a...
4
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, is there a way to run my javascript method on every async postback? thanks, rodchar
3
by: pablosuk78 | last post by:
Dear coders, I'm facing a problem and after few research I found that many ppl were looking around for the same solution, hope someone more expert than me could give a good help. I created an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.