Cache an object

  • Thread starter Thread starter Prashanth
  • Start date Start date
P

Prashanth

Hi,
I want to cache an object whose scope in only within the page. The
cache should expire once the user leaves the page. How can I do it?
Regards,
Prashanth
 
Sloan:
You are missing the viewstate. I only mention it because it might be what's
wanted in this case. "scope of the page" isn't particularly clear though, so
it's hard to tell. Context is ideal for dealing with the start of page
processing (say init) to the end (say prerender). If you want the data to
survive a postback, you'll need to do something more persistant. ViewState
might work, but it's rendered on the client so it needs to (1) be
serializable and (2) be small.

Karl
 
Ooooops!

You're right Karl... I forgot about that one!

That's why I should answer posts that early in the morning.




"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:[email protected]...
 
Karl,
I want the data to survive a post back but cannot use viewstate since
the objects is not serializable.
 
Well, either make it serializable(which isn't always possible) or you'll
need to persist it in memory. You are likely stuck using sessions.

Karl
 
Back
Top