Solved

How to avoid session timeout in asp.net

Posted on 2010-09-18
3
686 Views
Last Modified: 2013-11-28
How do I in Javascript manage the session timeout problem of an asp.net app? The hosting company (WebHost4Life) has set a standard session timeout of 90 sec (!!!???) which I am not allowed to override in my web.config file!
I have included an asp:timer control in an updatepanel  (in the master page) which keeps the app alive.
But I get a problem, because I have several updatepanels elsewhere in the app and theese updatepanels (which has updatemode=always) should not be refreshed every time I initiate the session timeout handling (each minute!).
I have seen some javascripts that are said to keep the app alive, but I cannot get them to work
0
Comment
Question by:Joar
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 33707933
as this is a common issue there should be plenty of examples on the web

http://www.codeproject.com/KB/session/Reconnect.aspx
(something similar to above lol but in code) http://gchandra.wordpress.com/2007/11/26/prevent-session-timeout-in-aspnet/

0
 

Author Closing Comment

by:Joar
ID: 33708511
I tried this one, but didn't work for me for some reason. Found this one which worked:

<script language="javascript" type="text/javascript">
function fnKeepSessionAlive()
{
    var myurl = "SessionKeepAlive.aspx";

if (window.XMLHttpRequest) {
xhttp = new XMLHttpRequest()
}
else {
xhttp = new ActiveXObject("Microsoft.XMLHTTP")
}
xhttp.open("POST", myurl, true);
xhttp.send("");



window.setTimeout("fnKeepSessionAlive();", 60000);
}

fnKeepSessionAlive();
</script>

0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33708541
sweet. thanks for the update. great post!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

815 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now