Hello,
I am trying to use the ASP.Net cache in a regular
vb class (not a code-behind page).
I can easily insert an object into the Cache from the code-
behind with something like:
Cache.Insert(cacheName, cacheData)
However when I try to put this in a new vb class, even
when I add the System.Web.Caching namespace, have the
project compile, I still get an "Object reference not set
to an instance of an object." error.
I've tried several variations, such as:
---
Dim c As New System.Web.Caching.Cache
c.Insert(cacheName, cacheData)
---
Stepping through in debug mode, c has been instantiated
and is {System.Web.Caching.Cache}.
Does anyone know what I could be doing wrong?
I've looked extensively at Microsoft's Caching Application
Block, but it doesn't seem to address this (it doesn't use
the ASP.Net cache).
Thanks,
Tim
John Saunders - 15 Sep 2003 22:14 GMT
> Hello,
> I am trying to use the ASP.Net cache in a regular
[quoted text clipped - 9 lines]
> project compile, I still get an "Object reference not set
> to an instance of an object." error.
Use HttpContext.Current.Cache.

Signature
John Saunders
Internet Engineer
john.saunders@surfcontrol.com
Tim S. - 16 Sep 2003 13:09 GMT
Thank you, that worked perfectly.
Tim
>-----Original Message-----
>> Hello,
[quoted text clipped - 12 lines]
>
>Use HttpContext.Current.Cache.