473,473 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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
1 14938

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Thomas Scheiderich | last post by:
I am trying to understand Session variables and ran into a question on how they work with data that is passed. I have an HTM file that calls an ASP file and sends the name either by GET or POST....
7
by: someone | last post by:
Let's say I have a Session timeout of 20 minutes. If the browser periodically request a graphic file, will that keep its Session alive? What keeps the Session alive? Is it the Session cookie that...
15
by: dee | last post by:
Hi, What is the maximum number of minutes for Session timeout that I can specify in web.config? Thanks. Dee
4
by: pgmanno | last post by:
Hello all, Here is my question. I have an AxWebBrowser (hereafter refered to as "Browser") control framed in a smart client. The smart client requires logon, and the web app that the Browser...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
6
by: laredotornado | last post by:
Hi, When a user logs into our site, we create a session variable to denote the session is active and another to denote who is logged in. Once the user closes the browser and re-opens it, the...
0
by: Ramchandar | last post by:
In my aspx page i want the lot of informations to be filled by the user. But wen the user takes some break to fill the form n resumes after some time the page gets expired. So to keep the session...
9
by: gnewsgroup | last post by:
I am using forms authentication for my web application. In web.config, I have this: <authentication mode="Forms"> <forms loginUrl="Login.aspx" protection="All" timeout="120"...
3
by: dihola | last post by:
Hi, I have a website running in IIS7 and it seems to be creating a new session for every request I make. The values I store in Session are lost with every request. This is the forms bit in my...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.