I guess this is my night to share .Net issues my students have uncovered . . . here’s one I don’t have an answer for . . .
The asp.net session objects (and cache objects) in her application are consistenly destroyed after a few page requests. This only happens on this one particular machine (isn’t it often that way?), so we immediately check the Session settings in Web.config and in IIS (session timeout property); everything checks out normally.
The Cache object is an easy one . . . when a server is running low on resources, the Cache dictionary can be scavenged by the server; it’s a “too few resources” thing. All work with a Cache object should begin by testing for the presence of the item in the Cache; you never know when you may have to recreate an object that was stored in the Cache. As an aside, check out this tip for a way to respond when an item is deleted from (it uses Delegates . . . a favorite topic of mine).
The Session object, however, is an odd one. I haven’t heard of Session objects being scavenged like Cache objects, but this was certainly looking that way — although Task Manager doesn’t show a heavy burden weighing on the machine. The Session object would have get a new Session ID, so the server is discarding the old session and regenerating a completely new one.
Requests from computers other than the server would still manifest this Session problem — so I eliminated the client browser configuration issue from consideration (thinking that, perhaps, the cookie that Session State relies on by default was being deleted or blocked by privacy software — no luck there).
So, while I’d like to share the solution to the student’s dilemma, we haven’t found one. She is going to work on a different server with “normal“ behaviour or avoid session state while playing with .Net on that server. I realize this isn’t an acceptable solution for the “real“ world, but so far this problem has only manifested itself in the “unreal“ world of academic licensed server and application software — and only one computer at that.
If anyone has any ideas I’m all ears!