Monday, March 26, 2012

serialization and Session Object

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, how do you go about serializing an entire
class?
Thanks much.BTW, using C#. Thanks
"Bilbo" <Bilbo@.cox.net> wrote in message
news:eZDMiA1aEHA.2516@.TK2MSFTNGP10.phx.gbl...
> 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, how do you go about serializing an entire
> class?
> Thanks much.
>
It only needs to be serializable if you using session state other then
InProc. If you are using InProc, you can place anything you want into
session.
"Bilbo" <Bilbo@.cox.net> wrote in message
news:eZDMiA1aEHA.2516@.TK2MSFTNGP10.phx.gbl...
> 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, how do you go about serializing an entire
> class?
> Thanks much.
>
"Bilbo" <Bilbo@.cox.net> wrote in news:eZDMiA1aEHA.2516
@.TK2MSFTNGP10.phx.gbl:

> is it necessary
> to serialize this object?
I think only if you're using session variables in a webfarm:
http://support.microsoft.com/defaul...b;EN-US;q312112
I never had problems storing complex objects in a sesion variable on a
single web server environment.
Lucas Tam (REMOVEnntp@.rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
[url]http://members.ebay.com/aboutme/spot18/[/url]
Check in your Web.config, that's where it is set. InProc is the default.
And if you haven't had any serialization warnings after putting custom
objects into session, then you're using InProc.
"Bilbo" <Bilbo@.cox.net> wrote in message
news:e$8bUo1aEHA.596@.TK2MSFTNGP11.phx.gbl...
> Thanks for your response. How can I tell if I am using InProc?
> Thanks.
>
> "Marina" <someone@.nospam.com> wrote in message
> news:O3%23RuF1aEHA.3820@.tk2msftngp13.phx.gbl...
it
> to
a
class
> entire
>
Thanks for your response. How can I tell if I am using InProc?
Thanks.
"Marina" <someone@.nospam.com> wrote in message
news:O3%23RuF1aEHA.3820@.tk2msftngp13.phx.gbl...
> It only needs to be serializable if you using session state other then
> InProc. If you are using InProc, you can place anything you want into
> session.
> "Bilbo" <Bilbo@.cox.net> wrote in message
> news:eZDMiA1aEHA.2516@.TK2MSFTNGP10.phx.gbl...
to
> is
> necessary
entire
>

0 comments:

Post a Comment