object persistence

A

Atif Jalal

I instatiate an object first time when an asp.net page loads. But when
the page reloads after Post Back, I get an error saying the object
does not exist. What do I need too do to make object persistant on
server?

Help appreciated.
 
S

Steve C. Orr, MCSD

Try putting the object into Session State or ViewState.

Sesssion("MyObject") = oMyObject

Then on postback:
oMyObject = CType(Session("MyObject"),cMyObject)
 
K

Kevin Spencer

Every time the Page reloads, all objects in it must be rebuilt from scratch.
Either, as Steve suggested, persist the object in some caching mechanism, or
re-create the object with each PostBack.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.
 

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

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top