How do I keep a session alive

My host has set a default session timeout of 20 minutes.  I've tried using session.timeout = 60 but this does not help me as it still times out.  How can I keep a session alive for a page without using the session timeout?  Generally people using the page will want to do some good thinking as they complete the form contained on the page... they need at least 45 minutes to complete it.
philwill4uAsked:
Who is Participating?
 
mmarksburyCommented:
Create a function in JavaScript that starts counting down from 20 minutes (in seconds) at page load.  When the timer gets to 15, have the function do something like redirect or display a message telling the user that the session is closing.
0
 
avinthmCommented:
There is another way to specify session time out.
You will have to specify in web.xml (ie your application config file)

Just add the following stuff in web.xml

    <session-config>
      <session-timeout>60</session-timeout>    <!-- 30 minutes -->
    </session-config>
0
 
avinthmCommented:
>  <!-- 30 minutes -->
sorry...it should be

<!-- 60 minutes -->
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
philwill4uAuthor Commented:
Hi,  do you mean my global.asa config file?  If yes, then this is where I currently have the session.timeout set to 60 but it still timesout in 20 minutes.
0
 
avinthmCommented:
can u tell me the technology u have used?
0
 
philwill4uAuthor Commented:
yes.... its classic ASP with VBScript
0
 
avinthmCommented:
oh sorry....i thought it was j2ee. not sure about ASP and VBScript.
0
 
deepaknetCommented:
Alternatively, you can also use from the clientside JavaScript to send a AJAX request to the server periodically.
0
 
philwill4uAuthor Commented:
Deepaknet....Do you have any sample code that I can use within ASP pages?
0
 
NightfalconCommented:
Try setting your timeout to 0
Keep in mind that with this setting, your page will never timeout!
0
 
smaccariCommented:
You can set the session timeout through your ASP script, just add at top of your ASP page:

<%Session.Timeout=60%>
0
 
philwill4uAuthor Commented:
I've tried the Session.Timeout = 60 but this doesn't work.  The host provider I have is using a web farm under Chill!soft and have set a default session time = 20 minutes.  

I think I need a javascript that can call the server to say 'I'm still here' when the timeout approaches 20 minutes.

Any ideas?
0
 
smaccariCommented:
You could have a hidden iframe in your page, and add a little script that refresh the page in it (an empty asp page should be enough):

<iframe name="sessionRefresh" id="sessionRefresh" style="display:none" src="myPage.asp"></iframe>
<script>
setInterval("frames['sessionRefresh'].reload()",900000); //will make the iframe refresh every 15 minutes
</script>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.