The other day, I had a niggling issue with session data. Initially, I could see no reason for my in-proc session data being lost between postbacks.After commenting out some code, I realised that deleting a sub-directory was causing the issue. In my case, I was creating sub-directories and saving files into them, to be downloaded by a user. For housekeeping, I was deleting directories that were older than an hour, and this is where the problem arose.
It seems that the default session state method, in-proc, does not play well with directories being deleted. The session is invalidated as the app domain is recycled. This is new behaviour with version 2.0.
Of course, I’m not the only one who’s experienced such problems, and a suggestion to delete all the files in a directory can be found here.