I want to be able to maintain certain objects between application restarts.
To do that, I want to write specific cached items out to disk in Global.asax Application_End()
function and re-load them back on Application_Start()
.
I currently have a cache helper class, which uses the following method to return the cached value:
return HttpContext.Current.Cache[key];
Problem: during Application_End()
, HttpContext.Current
is null since there is no web request (it's an automated cleanup procedure) - therefore, I cannot access .Cache[]
to retrieve any of the items to save to disk.
Question: how can I access the cache items during Application_End()
?