I'm working on a WebApplication, and I need to implement a cache mechanism. Basically I need to call a Webservice and update the cache with the results.
My first attempt was to do that with a timer. Created the class with methods to initialize the timer, the timer then calls the webservice and updates de cache. Then I simply call my class in the Application_Start.
The problem is that the webservice invoke is implemented in a utils class, and it needs HttpContext.Current, wich is always null. This is because the method of that utils class is called by the timer, wich basically does not have HttpContext.
After searching a lot of solutions I've tried with ExecutionContext and SynchronizationContext, but that does not seem to work either (or maybe I don't know how to use it), because they are always null.
So, what should I do?