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 4 5924
Any class stored in session must implement the ISerializable attribute. http://msdn.microsoft.com/library/de...classtopic.asp
--
Robbe Morris - 2004/2005 Microsoft MVP C#
Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com . http://www.eggheadcafe.com/forums/merit.asp
"Gary" <Ga**@discussio ns.microsoft.co m> wrote in message
news:1D******** *************** ***********@mic rosoft.com... 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
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" <Ga**@discussio ns.microsoft.co m> wrote in message
news:1D******** *************** ***********@mic rosoft.com... 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
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" wrote: 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" <Ga**@discussio ns.microsoft.co m> wrote in message news:1D******** *************** ***********@mic rosoft.com... 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
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
"Robbe Morris [C# MVP]" wrote: Any class stored in session must implement the ISerializable attribute.
http://msdn.microsoft.com/library/de...classtopic.asp
-- Robbe Morris - 2004/2005 Microsoft MVP C#
Earn money answering .NET Framework messageboard posts at EggHeadCafe.com . http://www.eggheadcafe.com/forums/merit.asp "Gary" <Ga**@discussio ns.microsoft.co m> wrote in message news:1D******** *************** ***********@mic rosoft.com... 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ben |
last post by:
Hi, there.
Recently I was working on a problem where we want to save generic
closures in a data structure (a vector). The closure should work for
any data type and any method with pre-defined signature.
When developing this lib, I figured that the
pointer-to-member-function, although seemingly an attractive solution,
does not work well...
|
by: Maximus |
last post by:
Hi Everyone,
I was using Inprocess session objects, but incase of aspnet process
crashes the session objects were lost as a result I decided to shift to
out of porocess session objects. For this i had to serialize the
objects. While doing that I made the classes serializable whose objects
I store in sessions. However, when I run the...
|
by: Bilbo |
last post by:
Hello,
I recently read that a class must support serialization in order for it to
be stored in the Session State. Before reading this I had been storing a
class to the Session State no problem (without serialization). The class is
simply a storage class and contains only primitive types....is it necessary
to serialize this object? If so,...
|
by: vinay |
last post by:
Hi Guys
I want to understand Serialization.
What is serialization.
When do we need to use??
What are advantages and Disadvantages.
Also please diret me to some good sites on serialization.
Thanks for all ur help.
|
by: AVL |
last post by:
Hi,
I'm new to .net. I need some info on serialization.
What is serialization? Why do we need it? Why objects need to be serialized
if they need to be stored in session or viewstate?
| |
by: jakk |
last post by:
Below is the exception that Iam getting. It says that the DataView that
Iam storing in the session is not Serializable. BUt works fine if I
store in the inproc session and fails if I switch to storing the
session in Sql Server.
Please let me know if Iam doing anything wrong.
Unable to serialize the session state. Please note that...
|
by: Coco |
last post by:
Hi,
I am currently migration my session state from InProcess to StateServer.
I notice that the object that i want to put in the session must be
serializable.
What about the objects like DataTable and Hashtable, how can i keep than
into the session, i don't think they are serializable. What if i am create a
collect object and make it...
|
by: Bjorn |
last post by:
Hi,
I read a lot of things about Serialization but i'm not sure i understand
what it is really doing.
Anyway, i use in my application the 'Profiles' which must contain things
like name of customers, address... and a kind of shoppinglist.
Therefore i created a class with "<Serializable()" and i created the
profiles in web.config and added...
|
by: JosAH |
last post by:
Introduction
Upon hearing the word, "Serialization", the first question which comes to mind is ...
"What is Serialization?" We know that we can create resusable objects in Java. But the lifetime of those objects lasts only as long as the Java virtual machine is running. Once we close the JVM, we lose all those objects.
What if someone...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |