Serialization of Session objects

G

Guest

Hello,

I have implemented SQL Server session state in my application however I am
having some problems. Simple objects stored in Session state are fine and are
handled by .NET, however when I try to store more complex objects such as an
ArrayList in session state I am not able to figure out exactly what I have to
do to serialize and deserialize the object.

There doesn't seem to be any code examples around when it comes to
serializing session objects. Could anyone provide me with some code that
would help?

I have managed to successfully serialize and deserialize an object to a file
but I am specifically looking to serialize the object to session state.

Thanks,

Gary
 
G

Guest

Hello,

Thank you very much for your reply, adding the <Serializable()> attribute to
my class has resolved my problem. I actually thought that you had to manually
serialize the object and then put it in to the session object, I had no idea
that .NET handles this for you as long as the serialization attribute is
added. I have spent the best part of my day trying to figure this out so
thanks very much!

Regards,

Gary

Eliyahu Goldin said:
Gary,

All you have to do is to put a line
[Serializable]

before definition of every class you are going to save in the session state.


Eliyahu

Gary said:
Hello,

I have implemented SQL Server session state in my application however I am
having some problems. Simple objects stored in Session state are fine and are
handled by .NET, however when I try to store more complex objects such as an
ArrayList in session state I am not able to figure out exactly what I have to
do to serialize and deserialize the object.

There doesn't seem to be any code examples around when it comes to
serializing session objects. Could anyone provide me with some code that
would help?

I have managed to successfully serialize and deserialize an object to a file
but I am specifically looking to serialize the object to session state.

Thanks,

Gary
 
G

Guest

Hello,

Thank you very much for your reply, adding the <Serializable()> attribute to
my class has resolved my problem. I actually thought that you had to manually
serialize the object and then put it in to the session object, I had no idea
that .NET handles this for you as long as the serialization attribute is
added. I have spent the best part of my day trying to figure this out so
thanks very much!

Regards,

Gary
 
E

Eliyahu Goldin

Gary,

All you have to do is to put a line
[Serializable]

before definition of every class you are going to save in the session state.


Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top