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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason

    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.as p" 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.imag es) return;
    document.images['myPic'].src = 'sessionkeepali ve.asp'
    setTimeout('ref reshIt()',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



  • Tim Williams

    #2
    Re: Help with session keep alive code using .asp as img src


    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 = 'sessionkeepali ve.asp?xxx='+es cape(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" <jasolution@spa m-none-yahoo.com> wrote in message
    news:vfun37dsv4 u85e@corp.super news.com...[color=blue]
    > 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[/color]
    back[color=blue]
    > to the login page instead of submitting the form.
    >
    > The solution I am trying (extending timeout session is not an option due[/color]
    to[color=blue]
    > 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[/color]
    is[color=blue]
    > 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.as p" page.
    >
    > Unfortunately, this is not keeping the session alive. Can someone shed[/color]
    some[color=blue]
    > light on why this method of keeping the session alive is not working?
    >
    > Here's some snippets of my code:
    >
    > function refreshIt() {
    > if (!document.imag es) return;
    > document.images['myPic'].src = 'sessionkeepali ve.asp'
    > setTimeout('ref reshIt()',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
    >
    >
    >[/color]


    Comment

    Working...