By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,784 Members | 1,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,784 IT Pros & Developers. It's quick & easy.

Help with session keep alive code using .asp as img src

P: n/a
I've got a standard form on an ASP page to collect resumes from visitors.
The page can be accessed only after the visitor has logged into the site.
The issue that I'm running into is that the users are exceeding the length
of the session timeout, so when they submit the form, it is taking them back
to the login page instead of submitting the form.

The solution I am trying (extending timeout session is not an option due to
the heavy load on this server) involves writing a Javascript timer that
triggers an automatic request for a .asp page by setting the object of an
IMG SRC tag. The JS calls the "image" X minutes before the session
expiration, and there's some basic asp code in the "keepalive.asp" page to
ensure that the asp interpreter is invoked.

I've checked the IIS logs and have confirmed that the keepalive.asp page is
being requested at the appropriate intervals, and I've also confirmed that
the session ID on those calls is the same as the initial call to the
"resumeinput.asp" page.

Unfortunately, this is not keeping the session alive. Can someone shed some
light on why this method of keeping the session alive is not working?

Here's some snippets of my code:

function refreshIt() {
if (!document.images) return;
document.images['myPic'].src = 'sessionkeepalive.asp'
setTimeout('refreshIt()',60000); // refresh every X minutes
}

and here's the code for the image/asp:

<img src="keepalive.asp" name="myPic" width="1" height="1">

Thanks,

Jason

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Two things to try:

1. Add a varying querystring to your clientside src request to ensure the
browser always avoids the cache.
Something like
document.images['myPic'].src = 'sessionkeepalive.asp?xxx='+escape(new
Date());

2. Your asp page should return an image, not an img html tag. Either
redirect to an image file or binarywrite an image file back to the response.

Tim


"Jason" <ja********@spam-none-yahoo.com> wrote in message
news:vf************@corp.supernews.com...
I've got a standard form on an ASP page to collect resumes from visitors.
The page can be accessed only after the visitor has logged into the site.
The issue that I'm running into is that the users are exceeding the length
of the session timeout, so when they submit the form, it is taking them back to the login page instead of submitting the form.

The solution I am trying (extending timeout session is not an option due to the heavy load on this server) involves writing a Javascript timer that
triggers an automatic request for a .asp page by setting the object of an
IMG SRC tag. The JS calls the "image" X minutes before the session
expiration, and there's some basic asp code in the "keepalive.asp" page to
ensure that the asp interpreter is invoked.

I've checked the IIS logs and have confirmed that the keepalive.asp page is being requested at the appropriate intervals, and I've also confirmed that
the session ID on those calls is the same as the initial call to the
"resumeinput.asp" page.

Unfortunately, this is not keeping the session alive. Can someone shed some light on why this method of keeping the session alive is not working?

Here's some snippets of my code:

function refreshIt() {
if (!document.images) return;
document.images['myPic'].src = 'sessionkeepalive.asp'
setTimeout('refreshIt()',60000); // refresh every X minutes
}

and here's the code for the image/asp:

<img src="keepalive.asp" name="myPic" width="1" height="1">

Thanks,

Jason

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.