Delete Directory in Session_OnEnd in GLOBAL.ASA 
Author Message
 Delete Directory in Session_OnEnd in GLOBAL.ASA

I am creating a temp directory in the Session_OnStart.  I use it in various
places on the site, but I can't delete the directory.  If I place the delete
code in a asp page, it works, but I can't be guarenteed that everyone will
go to that page by signing off.  Some people simply close their browsers.

I want to delete it in the Session_OnEnd.  It just WONT work.

I have the following Code in GLOBAL.ASA

Sub Session_OnStart
    set fs=createObject("scripting.filesystemobject")
    dlfld = "/Sitename/download/" + fs.GetTempName
    dlfldserver = server.mappath(dlfld)
    if not fs.folderexists(dlfldserver) then
      fs.createfolder(dlfldserver)
   end if
   session("dlfld") = dlfld
   session("dlfldserver") = dlfldserver
End Sub

Sub Session_OnEnd
  On Error Resume Next
  set fs=server.createObject("scripting.filesystemobject")
  dlfldserver = session("dlfldserver")
  fs.deletefolder(dlfldserver)
End Sub



Mon, 07 Jul 2003 23:21:21 GMT  
 Delete Directory in Session_OnEnd in GLOBAL.ASA
I am creating a temp directory in the Session_OnStart.  I use it in various
places on the site, but I can't delete the directory.  If I place the delete
code in a asp page, it works, but I can't be guarenteed that everyone will
go to that page by signing off.  Some people simply close their browsers.

I want to delete it in the Session_OnEnd.  It just WONT work.

I have the following Code in GLOBAL.ASA

Sub Session_OnStart
    set fs=createObject("scripting.filesystemobject")
    dlfld = "/Sitename/download/" + fs.GetTempName
    dlfldserver = server.mappath(dlfld)
    if not fs.folderexists(dlfldserver) then
      fs.createfolder(dlfldserver)
   end if
   session("dlfld") = dlfld
   session("dlfldserver") = dlfldserver
End Sub

Sub Session_OnEnd
  On Error Resume Next
  set fs=server.createObject("scripting.filesystemobject")
  dlfldserver = session("dlfldserver")
  fs.deletefolder(dlfldserver)
End Sub



Mon, 07 Jul 2003 23:22:41 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Session_onEnd not firing in global.asa

2. Known bug with Session_OnEnd method in Global.asa file

3. Deleting a file via Global.asa when session ends

4. global.asa and global.asax ?

5. Question: Global.asa

6. global.asa

7. Kill word instance from global.asa

8. Connection in Global.asa

9. Global.asa

10. Creating Com Object in Global.asa

11. Global.asa problem

12. Help with Global.asa

 

 
Powered by phpBB® Forum Software