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 ApplicaitonStat e. 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("i tem key", objectToCache, null, DateTime.MaxVal ue,
TimeSpan.FromSe conds(10));
#Cache.Insert Method (String, Object, CacheDependency , DateTime, TimeSpan)
http://msdn2.microsoft.com/en-us/library/4y13wyk9.aspx
Actually, the ApplicationStat e is provided for backward compatibility to
original classic ASP. You can use Application Cache to replace
ApplicationStat e 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.