Deleting ASP.NET application subdirectories causes application recycle!

Posted by geekrutherford on Geeks with Blogs See other posts from Geeks with Blogs or by geekrutherford
Published on Mon, 31 Jan 2011 16:28:51 GMT Indexed on 2011/01/31 23:26 UTC
Read the original article Hit count: 291

Filed under:

This may not be news to most people, but was definitely a shock to me!


 

In the .NET 2.x framework a "feature" was implemented where by an ASP.NET application is automatically recycled if any subdirectory is deleted. This was apparently implemented to prevent stale content from appearing on a site.


 

The unfortunate side effect of this "feature" is that when using the "InProc" model for session management, all session data is lost if a subdirectory is deleted.


 

For those who progammatically may be adding/deleting directories within their application as inherent functionality, this causes a rather large problem.


 

The solution? Create your folder(s) which may be programmatically deleted outside of the root folder for the application. Alernatively, utilize a file based structure vs. folders since deleting files does not result in the same issue.

© Geeks with Blogs or respective owner