object persistence

  • Thread starter Thread starter Atif Jalal
  • Start date Start date
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.
 
Try putting the object into Session State or ViewState.

Sesssion("MyObject") = oMyObject

Then on postback:
oMyObject = CType(Session("MyObject"),cMyObject)
 
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.
 
Back
Top