views:

23

answers:

1

I have some code in my logout routine that deletes some temporary session files when the user logs out or when the session expires. Deleting these folders causes my web app to restart. It does not error out or throws an exception it just restarts! Any ideas?

+4  A: 

That's by design. There's a threshold to the number of files that can change outside the bin folder, and if they do, the app restarts.

If you change anything at all inside the bin folder, it also restarts.

You need to save the temporary files somewhere else. You could save them in the %TEMP% folder (you can use Path.GetTempPath() to get it), or create a folder for them specifically OUTSIDE of your web app virtual directory and save the files there.

CubanX
I remember running into this issue under IIS and ASP.NET 2.0, and with directories there isn't even a threshold... Renaming or deleting any directory within your application's root or any of it's sub folders results in an application restart every time. Definitely need to store them somewhere else.
Rudism
Yeah, it can get you if you're not careful :) Can make an other wise fine running app run like a dog.
CubanX