• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • Last Modified:

session.timeout

in global.asa application_onStart i have
session.timeout=1
but it doesn't seem to execute the code i have in session_onend after one minute. what's wrong?
0
SSF
Asked:
SSF
  • 3
  • 2
  • 2
  • +5
1 Solution
 
hongjunCommented:
Try including the session.timeout = 1 in Session_OnStart instead.

hongjun
0
 
TTomCommented:
If you are serious about timing out your session, you can also configure the timeout for your server (or your application) through Internet Service Manager.

Tom
0
 
kmvCommented:
Let's assume that your site is very popular and at least one person uses it per a time. In this case Application_OnStart executes one time and only for one user who was the first.
MSDN:
The Application_OnStart event occurs before the first new session is created, that is, before the Session_OnStart event. Only the Application and Server built-in objects are available. Referencing the Session, Request, or Response objects in the Application_OnStart event script causes an error.

As hongjun wrote you need to use Session_onStart. You also can use code session.timeout=1 on page which always executed for every user if you have such page on your site (e.g. login page).

But there is one more problem. MSDN again:
When you save changes to the Global.asa file, the server finishes processing all of the current application requests before it recompiles the Global.asa file. During that time, the server refuses additional requests and returns an error message stating that the request cannot be processed while the application is being restarted.

I.e. you need to restart WWW server service or wait enouph time until all sessions for your application will finish. Restart of service reset all current sessions on all web applications on your server.

Best regards.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
weesiongCommented:
SSF,

This is the Session_OnEnd bug. :p

Regards,
Wee Siong
0
 
Michel SakrCommented:
Exactly weesiong,

Session_OnEnd is unreliable. Do not create applications that rely on Session_OnEnd to occur, because it doesn't always happen. This is a known bug and seems to have been reduced (if not eliminated entirely) in IIS 5.0, which ships with Windows 2000. This bug is one of many reasons to not store recordsets, connections or other objects in session variables, mainly the session timout fires randomly or even never fires so the session on end firing event is directly related to this..
0
 
guymsCommented:
SSF,

In the code for the OnEnd event procedure,you have access only to the Application, server, and session objects.
And most important, you have no access to the Response object or Request object if you have any of these objects in your OnEnd event that may be the problem.

0
 
makerpCommented:
SUB Session_OnStart
session.timeout=480

put it in Session_OnStart
0
 
SSFAuthor Commented:
thanks all! i'm giving this one to kmv and Silvers5.

Silvers5,
i'll post another question for you to get the points.

0
 
kmvCommented:
Thank you.

Best regards.
Michael.
0
 
SSFAuthor Commented:
makerp,
just out of curiosity, what does

session.timeout=480

do?
0
 
Michel SakrCommented:
480 minutes.. the session will time out in that amount, by default it's 20 minutes

rgrds
0
 
SSFAuthor Commented:
that doesn't seem very useful.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

  • 3
  • 2
  • 2
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now