views:

40

answers:

1

In a Classic ASP application, if I set Session.Timeout = 10 (or similar), can I execute a piece of code when the Session expires?

I would like to clear out values stored in the Application object when the user session ends.

Cheers.

+2  A: 

Yes, you can execute code when a session ends. This is what Global.asa is for. In it, you can define actions for certain events, among which is when your session ends.

These are the events you can use:

  • Application_OnStart
  • Session_OnStart
  • Session_OnEnd
  • Application_OnEnd

You'll probably want to use Session_OnEnd. This would be the name of a sub in Global.asa.

Source, and for more information: http://www.w3schools.com/ASP/asp_globalasa.asp

Rob
Ah, brilliant thanks, that's exactly what I was looking for.
Robert Dougan