Last post Apr 26, 2010 05:07 PM by Das.Sandeep
Apr 26, 2010 12:50 PM|SG_himadri|LINK
I have a object of Class named "Employee"
I need to store the object in the session.
what happens if i do not serialize the object and store in the session.
Apr 26, 2010 01:15 PM|DarrellNorton|LINK
It depends. If you are using InProcess session mode, then everything will work. If you are using State Server or SQL Server session mode, then you will get the following exception:
Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization
is done by the custom session state store in 'Custom' mode.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Apr 26, 2010 01:17 PM|Pratap09|LINK
The two most important reasons are to persist the state of an object to a storage medium so an exact copy can be recreated at a later stage, and to send the object by value from one application domain to another. For example, serialization is used to save
session state in ASP.NET and to copy objects to the clipboard in Windows Forms. It is also used by remoting to pass objects by value from one application domain to another.
Apr 26, 2010 01:17 PM|vik20000in|LINK
session can be stored in process or out of process in sql or state server. To store session in sql it needs to be serilized. check this article for more.
Apr 26, 2010 01:20 PM|suhasaraos|LINK
Serialization is not required to save objects in sessions that are in proc. However I think serializtion may be required if a StateServer or a SQL server server is used for holding sessions.
Apr 26, 2010 01:21 PM|riyazakt|LINK
see the bellow link:
Please mark the answer if it helped you
Apr 26, 2010 01:26 PM|paaresh|LINK
Session state could be InProc, StateServer, or SQLServer.
InProc keeps live object in memory. but StateServer and SQLServer needs serialization object
because StateServer keeps object in separate process and SQLServer keeps in SQL data base.
Refer "Oerview of ASP.NET Session State" @
Apr 26, 2010 05:07 PM|Das.Sandeep|LINK