[thelist] Deleting server files at session end?

Warden, Matt mwarden at odyssey-design.com
Mon Aug 7 11:55:20 CDT 2000


Scott Dexter can confirm this, but you can not delete files on session end
(and I believe the same is true for on application end). And, I don't really
know how good it is to store an instance of the Scripting.FileSystemObject
object in the session (if anything, I'd think you'd store it in the
application object).

What you could do is write a script that runs once a day and deletes
files/folders that haven't been modified for 60 minutes or whatever you
decide.

Let me know if this helps. If it doesn't, explain what the files are and
what you are trying to do and maybe we can help more.

--
mattwarden
mattwarden.com


----- Original Message -----
From: Jay Turley <jay at weberrific.org>
To: <thelist at lists.evolt.org>
Sent: Monday, August 07, 2000 12:25 PM
Subject: [thelist] Deleting server files at session end?


> Okay, evolters, I could use some help.
>
> A developer I work with is creating an ASP web application that by
> necessity creates some files during a user's session. We want to delete
> these files when the session ends. Currently, his code looks like:
>
> <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
>
> Sub Session_OnStart
>
> Set Session("FSOMain") = Server.CreateObject
> ("Scripting.FileSystemObject")
>
> End Sub
>
> Sub Session_OnEnd
>
> Session("FSOMain").DeleteFolder "C:\InetPub\wwwroot\Leads
> Site\printdocs\Ahoy"
> Session("FSOMain").DeleteFile "C:\InetPub\wwwroot\Leads
> Site\printdocs\smalllabel.rtf"
>
> End Sub
>
> The paths are of course hard-coded for our test case. The problem is that
> it just doesn't work. When session.Abandon is called, the session ends;
> files are still there.
>
> However, if the code is cut and pasted into an intermediate file
> (delPage.asp), it works just duckily.






More information about the thelist mailing list