Wrox Programmer Forums
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 20th, 2003, 09:35 AM
Registered User
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Prompt when session is terminated

my website creates a file on the server every time a member logs in, and the filename is passed as a session variable throughout the web. When the user physically logs off using a link on the website, a script locates the file using the session var and deletes the file. What I need to do is be able to delete the file if the user either closes their browser or if the session terminates (after 20 mins). I was playing around with the global.asa session_onend, but it isnt firing dynamically. Either way, I fear that if I direct the session_on end to a page with script to delete the file, I wont be able to because the session var for the filename will already be erased. Is there a way I can capture the filename elsewhere and delete it dynamically when the session is ended?

Any help would be awesome. Thank you so much for your time...

Old September 20th, 2003, 01:55 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi Andrew,

The Session variables are still present in the Session object in the OnEnd event. This means you can use them to retrieve the filename you want to delete.

Using Session_OnEnd is a bit tricky, though. It's not guaranteed that it will fire for each session you create, so you may end up with old files on your server.

You could add a date and time to the filename and then run a routine once in a while that checks old files and deletes them.

Alternatively, and IMO the preferred way , you can use a database to store the data. It's easier to scale a database driven site, than one that uses text files. Also, cleanup tasks are a lot easier in a database.



Imar Spaanjaars
Everyone is unique, except for me.
Old September 24th, 2003, 02:17 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega

This article might give you some ideas: http://www.asp101.com/articles/john/...nd/default.asp

- mega

Regards - Jon

Similar Threads
Thread Thread Starter Forum Replies Last Post
BizTalk Orchestration terminated Suddenly gmk51080 Biztalk 0 August 4th, 2008 03:07 AM
HAT only showing Terminated instances jwindang Biztalk 0 September 27th, 2007 08:36 PM
command prompt karthisena BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 27th, 2007 04:11 AM
Command Prompt karthisena General .NET 2 January 25th, 2007 12:29 PM
Command Prompt joconnor PHP How-To 1 August 11th, 2004 06:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.