Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1751
Number of posts: 4473

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Session times out too soon Posted by tbfromny on 26 Sept 2003 at 3:32 PM
I'm attempting to use a Session variable to store user information. I've got a main login page, and once I validate their login against my database, I store their login ID in Session. On subsequent pages, I've got code like this:

IF Session("loginID") = "" THEN
Response.redirect("default.asp")
END IF

so that if a user's session times out, or somebody tries to enter the middle of the site without logging in, they're redirected to the main login page.

I haven't done anything with Session.Timeout, so the timeout should default to 20 minutes, but sometimes it seems like it only takes 3-4 minutes of inactivity for my session to timeout.

What gives?

I'm running the site on a Windows 2000 server, IIS 5. I don't have frames, but I do have some pages loaded via Javascript (i.e., window.open).

I'm about this close to recoding everything to get away from Session variables (and I know there are real reasons to do this anyway), but that's going to be such a pain in the...

Thanks.
Report
Re: Session times out too soon Posted by lillu on 1 Oct 2003 at 2:14 AM
Give a value to the Session variable in the ASP page:

Session.Timeout = 10

This will set the timeout to 10 minutes. Check if timeout occurs in 10 minutes or not. This will give you an idea of where to look for the error.

: I'm attempting to use a Session variable to store user information. I've got a main login page, and once I validate their login against my database, I store their login ID in Session. On subsequent pages, I've got code like this:
:
: IF Session("loginID") = "" THEN
: Response.redirect("default.asp")
: END IF
:
: so that if a user's session times out, or somebody tries to enter the middle of the site without logging in, they're redirected to the main login page.
:
: I haven't done anything with Session.Timeout, so the timeout should default to 20 minutes, but sometimes it seems like it only takes 3-4 minutes of inactivity for my session to timeout.
:
: What gives?
:
: I'm running the site on a Windows 2000 server, IIS 5. I don't have frames, but I do have some pages loaded via Javascript (i.e., window.open).
:
: I'm about this close to recoding everything to get away from Session variables (and I know there are real reasons to do this anyway), but that's going to be such a pain in the...
:
: Thanks.
:


To err is human, but to really foul things up requires a computer. (Farmers Almanac)

Report
Re: Session times out too soon Posted by johnly on 9 Dec 2008 at 1:36 PM
I also faced the same problem with a site where around 400 users were hitting at the same time. The solution is that we need a better session management.
I will suggest you to change your web.config code like this.

<sessionState
mode="StateServer"
cookieless="false"
timeout="20"/>

Here I have changed the session state to a seperate worker process (ASP state management server).

It is recommended to move your session into the stateserver or SQL server state management in the production environment.

Note: You need to start the 'ASP.NET State Service' windows service on the web server in order to make this code work.

This will solve your problem related to session getting timed out before 20 minutes

<a href=http://www.johnleesam.com>Johnlee Sam</a>

: I'm attempting to use a Session variable to store user information.
: I've got a main login page, and once I validate their login against
: my database, I store their login ID in Session. On subsequent
: pages, I've got code like this:
:
: IF Session("loginID") = "" THEN
: Response.redirect("default.asp")
: END IF
:
: so that if a user's session times out, or somebody tries to enter
: the middle of the site without logging in, they're redirected to the
: main login page.
:
: I haven't done anything with Session.Timeout, so the timeout should
: default to 20 minutes, but sometimes it seems like it only takes 3-4
: minutes of inactivity for my session to timeout.
:
: What gives?
:
: I'm running the site on a Windows 2000 server, IIS 5. I don't have
: frames, but I do have some pages loaded via Javascript (i.e.,
: window.open).
:
: I'm about this close to recoding everything to get away from Session
: variables (and I know there are real reasons to do this anyway), but
: that's going to be such a pain in the...
:
: Thanks.
:

<a href=http://www.johnleesam.com>Johnlee Sam</a>



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.