Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Web Application Restarts When Deleting Directory

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?

like image 720
Arizona1911 Avatar asked Feb 26 '23 18:02

Arizona1911


1 Answers

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.

like image 81
CubanX Avatar answered Mar 07 '23 14:03

CubanX