Hi experts!
This is a difficult question.
How to delete temporary files when the user leaves the web page? Is it possible to do it with .NET? I'm starting to think it is not.
I have WebPage1.aspx. It will make some temporay files (*.gif or *.jpg). What I need is when the user leaves WebPage1.aspx, temporary files have to be deleted.
I try Javascript, using window.unOnload event. unOnload event will call a Logout.aspx that will delete the temporary files using: File.Delete("c:\Inetpub\
'On WebPage1.aspx
<Script language="javascript">
function endSession()
{
window.open( "}
</Script>
<body onUnload="endSession()">
'On Logout.aspx
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
File.Delete("c:\Inetpub\End Sub
However, on every SUBMIT of WebPage1.aspx, it will raise window.onUnload, which means File.Delete("c:\Inetpub\ will be executed on every SUBMIT as well. But I just need it be executed when the user leaves the page.
As you can notice, I just want to delete temporary files on a directory when the user leaves the web page. Is it so difficult with .NET?
Be aware that Session_End doesn't work here, because it doesn't fire when the user close the browser. It will fire when time pass out.
Thanks a lot!
This is a difficult question.
How to delete temporary files when the user leaves the web page? Is it possible to do it with .NET? I'm starting to think it is not.
I have WebPage1.aspx. It will make some temporay files (*.gif or *.jpg). What I need is when the user leaves WebPage1.aspx, temporary files have to be deleted.
I try Javascript, using window.unOnload event. unOnload event will call a Logout.aspx that will delete the temporary files using: File.Delete("c:\Inetpub\
'On WebPage1.aspx
<Script language="javascript">
function endSession()
{
window.open( "}
</Script>
<body onUnload="endSession()">
'On Logout.aspx
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
File.Delete("c:\Inetpub\End Sub
However, on every SUBMIT of WebPage1.aspx, it will raise window.onUnload, which means File.Delete("c:\Inetpub\ will be executed on every SUBMIT as well. But I just need it be executed when the user leaves the page.
As you can notice, I just want to delete temporary files on a directory when the user leaves the web page. Is it so difficult with .NET?
Be aware that Session_End doesn't work here, because it doesn't fire when the user close the browser. It will fire when time pass out.
Thanks a lot!