Solved

How to avoid session timeout in asp.net

Posted on 2010-09-18
3
687 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…

828 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