D
Dave
I am currently having a problem with retaining the cache in my asp.net
application. I am trying to insert a small DataView into cache, then
recall it on various pages throughout the site. When on any page other
than the page that inserted the cache, the DataView is null (not the
cache object, but the DataView itself). I'm curious as to if my code
is wrong, or if the DataView wasn't meant to be placed into cache.
// Code for insert
System.Web.HttpContext.Current.Cache.Insert(
"key",
dataView,
null,
DateTime.Now.AddHours(1),
TimeSpan.Zero
);
// Code for recall
DataView dv = (DataView)System.Web.HttpContext.Current.Cache[key];
Am I doing anything wrong? Might there be an entry that I would need
to add to my web.config to enable the cache? And on a side note, is
there a limit to the amount of characters placed in the key string?
Thank you,
Dave
application. I am trying to insert a small DataView into cache, then
recall it on various pages throughout the site. When on any page other
than the page that inserted the cache, the DataView is null (not the
cache object, but the DataView itself). I'm curious as to if my code
is wrong, or if the DataView wasn't meant to be placed into cache.
// Code for insert
System.Web.HttpContext.Current.Cache.Insert(
"key",
dataView,
null,
DateTime.Now.AddHours(1),
TimeSpan.Zero
);
// Code for recall
DataView dv = (DataView)System.Web.HttpContext.Current.Cache[key];
Am I doing anything wrong? Might there be an entry that I would need
to add to my web.config to enable the cache? And on a side note, is
there a limit to the amount of characters placed in the key string?
Thank you,
Dave