Please help on delete after living

Results 1 to 2 of 2

Thread: Please help on delete after living

  1. #1
    Join Date
    Dec 1969

    Default Please help on delete after living

    I&#039m trying to delete a file that is dynamically generated when the user loads a certain page. When the user either exits the browser or goes to a different URL, I want to be able to delete the file off of the server. Right now I&#039m using this with no luck: <BR><BR>DeleteFile.asp <BR>---------------- <BR>&#060;%@ Language=VBScript %&#062; <BR><BR>&#060;% <BR>Dim objFS, fname <BR><BR>fname = Session("fname") <BR>Response.Write "fname: " & fname <BR>Set objFS = Server.CreateObject("Scripting.FileSystemObject") <BR>&#039Check if the file is existing <BR>If objFS.FileExists (fname) Then <BR>objFS.DeleteFile fname, True <BR>End If <BR><BR>Set objFS = nothing <BR>%&#062; <BR><BR>In the page the generates the file, I&#039m using this: <BR><BR>&#060;body... onunload="DeleteFile.asp"&#062; <BR>... <BR>&#060;/body&#062; <BR><BR>Is there anyway to call and execute an asp page when the page unloads?<BR><BR><BR>Thanks in advance

  2. #2
    KPW Guest

    Default RE: Please help on delete after living

    For your onUnload event you might try <BR><BR>&#060;BODY onUnload="top.location.href=&#039DeleteFile.asp&#0 39"&#062;<BR><BR>I think, though, that this might muck up the user&#039s browsing unless you are able to trap the URL that the user wants to go to and then redirect them there from your DeleteFile.asp.<BR><BR>(Then again, maybe after going through DeleteFile.asp the user will be flawlessly directed to the new page. I&#039m not sure.)<BR><BR>HTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts