I have an Util class that goes through multiple xml files. Since there may be many of them I want to cache their data. So, how (and is it even possible) can I get to the application’s Cache object? I know I can use it in my controllers through HttpContext.Cache, but in other classes?
Ah, when I try to construct Cache object in my Util class I get NullReferenceException…
Try
using System.Web;
and then use HttpContext.Current.Cache
in your Util class. That’s what I see working.