"Soha El-Saeed" <selsaeed1@gawab.com> wrote in message
news:69069de6.0402032008.6a897071@posting.google.c om...[color=blue]
> Dear All;
> I wrote this code in the global.asa but it dosen't work inspite that
> it works in any asp file and also in the global.asa file but only in
> the session_onstart part.This code is to delete a txt file at the end
> of the session.The file was created during the user's session and has
> the name of the session id. The session variable "session("mpath")" is
> the varible which will hold the path of the created file. This is my
> first question also I want to know how to set the session.timeout and
> where to place it in the code?
>
>
> <SCRIPT LANGUAGE=VBScript RUNAT=Server>
> sub session_onstart
> session("id")=0
> session("mpath")=""
>
> end sub
>
> sub session_onend
> set fsoglob=server.createobject("scripting.filesystemo bject")
> cpath=session("mpath")
> set Cfolder=fsoglob.getfolder(cpath)
>
> for each file in Cfolder.files
>
> if instr(1,file.name,session.sessionid&".txt",1) then
> fsoglob.deletefile(file)
> end if
> next
> fsoglob.close
> set fsoglob=nothing
>
> end sub
> </script>
>
> Thank You[/color]
Session_onend is not reliable (
http://www.aspfaq.com/show.asp?id=2078).
Plus, you are referring to session vars which don't exist by that time.
Instead, I would run a process on user login that deletes files which are
older than a specified amount.
You can place the session.timeout command in the Session_OnStart event.
--
John Blessing
http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.free-helpdesk.com - Completely free help desk software !
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook