session object to store class objects
-
i have address class. i have to store this class object in session object until when application is not closed. how to do it?please provide some guidance
-
i have address class. i have to store this class object in session object until when application is not closed. how to do it?please provide some guidance
Hi deepali as per i know about session, any thing carry by session remain until the application alive, respective of session time alloted to it.
Hello Forum Always be in touch to help about the topic ASP.NET
-
i have address class. i have to store this class object in session object until when application is not closed. how to do it?please provide some guidance
Session
is a dictionary where you can add object based on key/value pair. When you want to add something, you give a key that you should use later to retrieve the object. So, supposing that your class is calledAddress
, you would save it in session like this:Address myAddress = new Address();
// do something with myAddress
Session["address"] = myAddress;To retrieve it, you would do this:
Address mySessionAddress = (Address)Session["address"];
I put "address" as an example for a key, but you can use any string. Just be sure to use the same string to put in session and retrieve from session. Hope this helps Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook
-
i have address class. i have to store this class object in session object until when application is not closed. how to do it?please provide some guidance
deepalititi wrote:
i have to store this class object in session object until when application is not closed.
Application is not closed means ? Do you mean browser ? If yes Talal's solutions is the best. Else you need to go with application variables.