Hi I am trying to delete file created by users during there session on my site.
How to I make so these files can be deleted on session_onEnd or is there a
better way to do this. I have created a logout button that deletes the users
files but if they don't click it the file don't get cleaned out.
this is the code I have been trying in the global.asa but it won't work.
Sub Session_OnEnd
Dim TheID
Dim fso, MyFile, IsitThere, FileToBeRem
TheID = session("TheUsersSessionID")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Connectionstring = "DSN=MyDatabase;DRIVER={Microsoft Access Driver
(*.mdb)}"
objConn.open
Set objrsRec99 = Server.CreateObject("ADODB.Recordset")
strSQL= "SELECT * FROM FileTable"
objrsRec99.Open strSQL,objConn4, 2, 3
if objrsRec99.Bof <> True Then
objrsRec99.MoveFirst
end if
Do While Not objrsRec99.EOF
if TheID = objrsRec99.Fields("TheID") then
FileToBeRem = objrsRec99.Fields("FileName")
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(Server.MapPath("Temp/" & FileToBeRem)))Then
IsitThere = true
Else
IsitThere = false
End If
if IsitThere= true then
Set MyFile = fso.GetFile(Server.MapPath("Temp/" & FileToBeRem))
MyFile.Delete
end if
objrsRec99.Delete
objrsRec99.MoveNext
else
objrsRec99.MoveNext
end if
set fso = nothing
Loop
set objrsRec99 = nothing
objConn.close
End Sub
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/