[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I keep a session alive

Posted on 2006-04-19
14
Medium Priority
?
1,145 Views
Last Modified: 2010-04-06
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.
0
Comment
Question by:philwill4u
  • 5
  • 4
  • 2
  • +3
14 Comments
 
LVL 6

Expert Comment

by:avinthm
ID: 16495148
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
 
LVL 6

Expert Comment

by:avinthm
ID: 16495152
>  <!-- 30 minutes -->
sorry...it should be

<!-- 60 minutes -->
0
 

Author Comment

by:philwill4u
ID: 16495175
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:avinthm
ID: 16495210
can u tell me the technology u have used?
0
 

Author Comment

by:philwill4u
ID: 16495222
yes.... its classic ASP with VBScript
0
 
LVL 6

Expert Comment

by:avinthm
ID: 16495240
oh sorry....i thought it was j2ee. not sure about ASP and VBScript.
0
 
LVL 6

Expert Comment

by:avinthm
ID: 16495285
0
 
LVL 15

Expert Comment

by:deepaknet
ID: 16496310
Alternatively, you can also use from the clientside JavaScript to send a AJAX request to the server periodically.
0
 

Author Comment

by:philwill4u
ID: 16496977
Deepaknet....Do you have any sample code that I can use within ASP pages?
0
 
LVL 1

Expert Comment

by:Nightfalcon
ID: 16498328
Try setting your timeout to 0
Keep in mind that with this setting, your page will never timeout!
0
 
LVL 9

Expert Comment

by:smaccari
ID: 16502947
You can set the session timeout through your ASP script, just add at top of your ASP page:

<%Session.Timeout=60%>
0
 

Author Comment

by:philwill4u
ID: 16503009
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
 
LVL 7

Accepted Solution

by:
mmarksbury earned 400 total points
ID: 16504792
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
 
LVL 9

Assisted Solution

by:smaccari
smaccari earned 1600 total points
ID: 16505813
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question