views:

151

answers:

2

I used iis6, and when i called a function Directory.delete(), the all the session relate this website will be logged out. and i debugged the website, i found no exception. any one have ideas on this ? Thanks in advance!

+1  A: 

If you create, delete or change any directory or files underneath the web application directory while the app is running, ASP.NET unloads the appdomain thinking that the code has changed and needs to be reloaded. This clears all session state, etc. You'll need to move any file/directory create/delete/change stuff to a directory outside the web application directory.

nitzmahone
+2  A: 

I assume the directory you are trying to delete is within the website folder.

When you delete a folder inside a website, then asp.net will restart resulting in loss of session state.

To avoid this problem

1) Try to implement out-of-process session state.

OR

2) Move the folder out of web application folder.

Rasik Jain