I’m writing a webapp that will only be used by authenticated users. Some temporary databases and log files will be created during each user session. I’d like to erase all these temp files when the session is finished.
Obviously, a logout or window close event would be sufficient to close the session, but in some cases the user may keep the browser open long after he’s finished.
Another approach would be to time user sessions or delete the temp files during routine maintenance.
How do you go about it?
User sessions should have a timeout value and should be closed when the timeout expires or the user logs out. Log out is an obvious time to do this and the time out needs to be there in case the user navigates away from your application without logging out.