Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete files when user leaves page 1

Status
Not open for further replies.

majorbroncosfan

Programmer
Feb 23, 2001
121
US
I am utilizing an active server page to be able to dynamically create certain image files when the user performs a certain action. I have successfully created a delete function in COM+ to be able to effectively delete the file from the web server, but can't figure out how to perform this action when the user leaves the page. I tried the onUnload event in the BODY section, but it only deletes the image prior to the page loading.
 
I have encountered the same types of problems in my experiences, also, and the best 'fix' I have found is to 'encourage' the users to hit some logout button that will actually lead to some simple asp page that will (1) call the delete function, and then (2) promptly redirect them to whatever page you wish. The page's code would look something similar to:
Code:
<%@language=vbscript%>
<%
call yourDeleteFunction
response.redirect(&quot;yourFavoritePage.htm&quot;)
%>

I'll state the horribly obvious by saying that the delete funtion will have to be on the page, also (or included in some .inc file)

Just make sure that the asp page doesn't have any html headers or anything on it (this will cause a run-time error), and it won't even show in the history. So if they hit 'back', they will go back to the page that they logged out on.

hope it helps!:)
Paul Prewett
 
Thanks for the help! That's a great idea. I had tried going toward the &quot;at&quot; command for Windows 2000, but found it to be a tedious task at best.

Thanks again!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top