1

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...

1 Answer 1

2

Try using System.Web;

and then use HttpContext.Current.Cache

in your Util class. That's what I see working.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.