DeleteFile doesn't work in Session_OnEnd???

T

Tom Bates

I can successfully delete files using fso.DeleteFile when in an ASP
script. But in Session_OnEnd, where I'd *really* like to clean up
files, it appears that DeleteFile doesn't work. I've tried every
combination I could think of. I've verified the filespecs I'm using by
logging to a session log file.

BTW, I found out the hard way that I can't reference
Request.ServerVariables("APPL_PHYSICAL_PATH") from within
Session_OnEnd. I had to copy that to Session("AppPath") to keep it
around for the OnEnd event. Without that, ASP just bails out of OnEnd,
ignoring the remainder of the subroutine.

I need to clean up temporary output files when a session ends.

Any suggestions?

TIA
Tom
 
B

Bite My Bubbles

that;s the problem by design etc of session_onEnd.

There are lots of articles on that but, in the end, it won;t work.
 
E

Egbert Nierop \(MVP for IIS\)

Tom Bates said:
I can successfully delete files using fso.DeleteFile when in an ASP
script. But in Session_OnEnd, where I'd *really* like to clean up
files, it appears that DeleteFile doesn't work. I've tried every
combination I could think of. I've verified the filespecs I'm using by
logging to a session log file.

This might be caused by security problems.

Session_OnEnd runs under iwam_ and not under iusr_ or the user that logged
in (if anonymous loggin is not used)

--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

BTW, I found out the hard way that I can't reference
Request.ServerVariables("APPL_PHYSICAL_PATH") from within
ServerVariables are kept between browser and server. At Session_OnEnd there
is no browser :)
 
T

Tom Bates

WooHoo! That's It!

I didn't realize that the Session_OnEnd ran under a different user ID.
I added IWAM_<node> permissions and that took care of it.

Thanks *very* much, Egbert, for the help. My hair can now start to
grow back in. :)

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top