How to reflect changes in class guidance on another page

I have one class. I need the same instance of the same class in two different pages with the previous values ​​referring to this instance.?

since keep the b / w instance value of two pages ....

0


a source to share


2 answers


Save it in session:



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

// Read
MyObject myObject = (MyObject)Session["MyInstance"];

      

0


a source


You have 3 options:

1) Add it to the HTTPContext elements and execute Server.Transfer to other pages. -great if you are doing some kind of wizard - doesn't work well with ajax at all



2) Use a session variable - quick and dirty - won't work in a farm environment - attachments sound big; can be hard in system memory

3) Store in some kind of database and retrieve it on subsequent pages. - harder to design - users can come back later and still get their data - statelessness is better supported and works well on farms

0


a source







All Articles