tags:

views:

20

answers:

2

hi evary one

I have one class.I need the same instance of the same class at two differnt pages with previous values assigend to that instance.?

so how to maintain the value of a instance b/w two pages....

Its very urgent ..pls suggest something..?]

A: 

Store it in session:

// Store
Session["MyInstance"] = myObject;

// Read
MyObject myObject = (MyObject)Session["MyInstance"];
Mehrdad Afshari
A: 

You have 3 choices:

1) Add it to the HTTPContext items and do a Server.Transfer to the other pages. -great if you are doing some sort of a wizard -does not work well with ajax at all

2) Use a session variable - quick and dirty - won't work well in a farm environment - attachments sound large; could be hard on the system memory

3) Store in a database of some sort and fetch on subsequent pages. - most complicated to develop - users can come back later and still get their data - statelessness is better maintained and works well on farms

DancesWithBamboo