[thelist] Deleting server files at session end?

Jay Turley jay at weberrific.org
Mon Aug 7 11:27:18 CDT 2000


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.

Any ideas, oh mighty ASP warriors?

- Jay Turley ---------------------------------------------------------
  http://www.weberrific.org
 "Any sufficiently advanced magic is indistinguishable from technology"




More information about the thelist mailing list