Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to avoid session timeout in asp.net

Posted on 2010-09-18
3
Medium Priority
?
695 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 1500 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

688 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