class - save from page to page

K

Karl Seguin [MVP]

I take it you mean an object (an instance of a specific class).
You need to store it somewhere. If you are exclusively using Server.Transfer
for navigation (unlikely) you can store it in Context.Items, else you need
to persist it in the session (or the cache, but there are implications to
this).

If your sessionState isn't set InProc, the class will have to be
serializable.

Karl
 
K

Karl Seguin [MVP]

Well, if you are using InProc sessions, then a simple reference to the class
on the heap is stored...works great.

If you are using StateServer or SQLServer as your session store, you can't
store heap memory, but rather need to be able to serialize the data. For
basic types, this is as simple as marking the Serializeable attribute on the
class. For more difficult classes, you need to serialize it yourself. If you
aren't using anything but InProc, don't worrya bout it.

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top