Hi Lucius,
For your scenario, you want to store some shared objects in the global
Application State collecction and make it be cleared after a certain
period. I think you'd better consider using the Application Cache instead
of ApplicaitonState. The Application Cache is also a global storage of
ASP.NET application and you can store and access items into it like a
dictionary. Also, you can supply a CacheDependency for each cache item so
as to control how will the cached item expired(be removed from cache
collection). e.g.
//cache and object and supply the lifetime(to expire)
Cache.Insert("item key", objectToCache, null, DateTime.MaxValue,
TimeSpan.FromSeconds(10));
#Cache.Insert Method (String, Object, CacheDependency, DateTime, TimeSpan)
http://msdn2.microsoft.com/en-us/library/4y13wyk9.aspx
Actually, the ApplicationState is provided for backward compatibility to
original classic ASP. You can use Application Cache to replace
ApplicationState in ASP.NET application.
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.