Solved

How to avoid session timeout in asp.net

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

636 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