473,888 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP Session Early Timeout

4 New Member
I've written a single load AJAX application that uses Session variables to store User information etc.

Upon validating the username and password entered against the values stored in a database I wither the current session ID to a a variable as:

Expand|Select|Wrap|Line Numbers
  1. Session("VSession")
  3. On each HTTP Request, I check the session for expiration.
  5. Function ValidateSession()      '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  6. If Session("Vsession") = Nothing then 'Session expired 
  7.     Session("State")="Expired"
  8. Else
  9.     Session("State")="Active"
  10. end if    
  12. End Function'------------------------------------------------------                
I'm using the default Session.Timeout = 20 in the Global.asa file.

But sometimes it is just a matter of seconds and Session("VSessi on") is Nothing. Rarely will my session variables survive 10 minutes. Any idea would be greatly appreciated. - GrnMtn
Aug 10 '08 #1
5 3487
4 New Member
Afte posting my question I realized I probably didn't explain my issue very well so here's an overview of what's happening:

1) A user loads the home page, (default,asp).
2) Upon entering the username and password, the information is authencated against the userdata in a database.
3) If the username / password are correct, then a session variable is set:
Session("VSessi on") = Session.Session ID
4) At this point all subsequent server client interaction is via HTTPRequest.

Expand|Select|Wrap|Line Numbers
  1. function LoadPage(RStr)
  2. {   var XMLreq = new ActiveXObject("Microsoft.XMLHTTP"); 
  3.     MLreq.open("GET", RStr, true);  
  4.     XMLreq.onreadystatechange = function()
  5.     if (XMLreq.readyState == 4) 
  6.     {   if (XMLreq.responseText.indexOf("Session Expired")!=-1)  
  7.         {  location = "../default.asp"
  8.         }
  9.             document.getElementById("DivMain").innerHTML = XMLreq.responseText;
  11.     }
  12.     XMLreq.send(null); 
  13. }
  15. when each HTTPRequest is received by the server I validate the session with the following function.
  17. Function ValidateSession()     
  18. If Session("Vsession") = Nothing then 
  19.    Response.Write("Session Expired")
  20.    Response.End
  21. End if    
Hopefully this is a better explaination of what I'm trying to do. The problem is that while the Session.Timeout = 20 my sessions seem to expire at random times well short of 20 minutes. Any help would be greatly appreciated. -Dennis
Aug 11 '08 #2
3,406 Recognized Expert Specialist
What program did you use to write your code (what is your ide)? I have heard of a bug, but it is apparently ide-dependent.

Aug 12 '08 #3
4 New Member
I'm doing this in Visual Web Developer 2005. - Dennis
Aug 12 '08 #4
4 New Member
I think I found the answer buried deep in the following blog:

http://blogs.msdn.com/david.wang/archive/2005/09/19/Why_do_I_lose_A SP_Session_Stat e_on_IIS6.aspx

# re: Why do I lose ASP Session State on IIS6
Thursday, April 24, 2008 12:16 PM by John Homer
The ASP (not .Net) session timeout is stored in the ASP application configuration. This is accessed via the website properties (not the application pool) on the Home Directory tab. Click the configuration button and then select the Options tab. You may then set the ASP session timeout valus in minutes which is 20 by default. This will terminate any session afetr 20 minutes on inactivity.

Note that this is independent of the application pool settings. In fact, you don't even need an application pool to utilize this setting. For instance, you can configure IIS 6 to run in IIS 5 compatibility mode (or just use IIS 5) and then configure your ASP Application Protection (Home Directory tab in website properties) to "Low (IIS Process)" which will run the application in-process (inside the inetinfo.exe process instead of w3wp.exe or dllhost.exe). Even in this scenario, the ASP timeout setting mentioned above is still effective.

For ASP.Net you can configure the session timout in your application's web.config. Look for the following line and configure accordingly:

<sessionState mode="InProc" cookieless="fal se" timeout="20"/>

I'm still testing but after setting the Isolation Mode to IIS 5.0 I haven't had a unexpected session expiration in over an hour. - Dennis
Aug 12 '08 #5
3,406 Recognized Expert Specialist
Good Info! thanks for sharing your solution.

Aug 12 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Carpe Diem | last post by:
Hello I have an aspx page that loses Session("user") value after a few minutes even after I set <sessionState mode="InProc" cookieless="false" timeout="300"> in web.config and wrote function Session_Start() { Session.Timeout = 3000; } in global.asax
by: DavidS | last post by:
First: There are several ways to confuse one regarding session timeout. (1) web.config - <sessionState timeout="20"> (2) IIS Manager | Internet Information Services | ServerNode | Default Web Site | Properties | Configuration | Options | Enable Session State Session timeout 20 (3) within Global.asax.vb file - Session_Start subroutine can use Session.Timeout=x minutes or (4) within any web page, i.e., <web page>.aspx can use...
by: Mr m?ll | last post by:
Hi Im quite new to web programming and I'm buildning this ASP .net page. I use VS 2003 and C# + IIS 5. The page consists of a login page that leads to a frame page (with some pages, reading from a MSDE-database) In the projects web.config-file I have sessionState mode="InProc" cookieless="true" timeout="40"
by: gg | last post by:
still can't figure this out. I have timeout in web.config set to 480. That should be 8 hours, right? Yet it still seems to be timing out after a short time, (perhaps the 20 minutes still). I've done a restart on IIS, but that has not helped. What would cause an early timeout? Thanks
by: Vishal | last post by:
Hello, can anybody tell me how I can extend the session expiry time? Is it done via code or via IIS? Sorry I am new and dont know about this.
by: ACaunter | last post by:
Hi all, I was wondering how i could write some code which would automatically open the Login Page once the session has expired? -- AdamPC@hotmail.com
by: UJ | last post by:
I have a page where the user can upload a video file. As you can guess, this may take a while. Is there a way I can change the session timeout for just this one page? I would also want to change the forms authentication to be a large value for that page also. TIA - Jeff.
by: pintu | last post by:
Hi Friends. in my application i am facing problems in maintaining session state. I am working on asp.net 2.0. So i didnt checked the session on each page and almost the project is completed. Now problem is like after 20 minutes the session gets ended.so session related errors are coming when any operation like insert or update is performed after that 20 minutes. how can i redirect that page to login page after session timeout.I hav to...
by: Bishop | last post by:
ASP.NET 2.0/IIS 6/Windows 2003 I have all my session settings set to the standard 20 min. but many times the session will time out prior to 20 min. of inactivity. My questions are: 1. Is there any way to find out why a session was reset? 2. Is there anything other than a session ID I can use to record data throughout a "session" (From the time someone starts visiting until they finish) I can't use client IP address because we get to...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.