Private Cache Object in ASP.NET?

If you mean private in the sense that you're creating a component that you will distribute to other programmers, and you want to cache stuff with your component but hide the cache item details that you're caching from programmer's prying eyes, you can't use Cache that way.

Up vote 1 down vote favorite share g+ share fb share tw.

I need to utilize the Cache object in ASP. NET to store some data with a file dependency but I can't have it available to the rest of the application. There could be some security violations if someone set the cache item to something different.

I couldn't find a way to say the cache item is private to my assembly. I was expecting to be able to create my own new Cache(), but checking for a value, mycache"Value"! = null, is throwing an null reference exception from the inards of the object.

I'm assuming because the Server. Cache object is created with some other stuff that initializes the Cache object correctly. Does anyone know how I can make an item private, or initialize my own Cache object?

EDIT: Inserting an item also throws a null reference exception. Mycache. Insert("item", true) asp.net caching link|improve this question edited Feb 10 '11 at 21:13 asked Feb 10 '11 at 21:06Joshua Belden2,209620 69% accept rate.

If you mean private in the sense that you're creating a component that you will distribute to other programmers, and you want to cache stuff with your component but hide the cache item details that you're caching from programmer's prying eyes, you can't use Cache that way. You can encrypt your cache items though. Providing your encryption scheme is secure, programmers will be able to override your cached items, but you will always be the only one who can decrypt your encrypted values.

If decryption fails, then you know that the cache has been tampered with.

Technically there is no way to hide the cache from a programmatic aspect. The way to achieve something similar is to create a wrapper and force everyone to use this wrapper to extract the data. The wrapper can sit on top of the cache, and as long as everyone goes through the wrapper, it can work as expected.

But there is nothing available to privatize this unless you use a whole other construct that's instantiated and managed by the application (say EL cache for instance). HTH.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions