Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object session storage/serialization?

Status
Not open for further replies.

gregmosu

Programmer
Jul 8, 2002
117
US
I have an object that stores some search data that the user will need to have around through the duration of the session.

quick example:
Code:
Public Class SearchList
  Private sqlString1 As String = ""
  Private sqlString2 As String = ""
  Private sqlString3 As String = ""
  //some get and set methods below...

End Class

This is not something I want to store in the database or pass around in the Request object. If this were java, I would simply say Session.setAttribute("mySearch", SearchObject); and I could grab this object from the Session at any time. Also, I remember having to serialize an object to the disk in php(a long time ago) when I needed to save data. Does anyone have any input or tips on this? I've found some info on serialization using xml, and next to nothing on storing objects in the session.

Thanks,
Greg
 
I think you just need to add the Serializable attribute to your class to make it work. You can improve the efficiency with custom serialization with a custom TypeConverter or something, but it's not necessary.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top