Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Storing Session in Sql Server Serialization exception

Reply
Thread Tools

Storing Session in Sql Server Serialization exception

 
 
jakk
Guest
Posts: n/a
 
      03-07-2005
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
non-serializable objects or MarshalByRef objects are not permitted when
session state mode is 'StateServer' or 'SQLServer'

[SerializationException: The type System.Data.DataView in Assembly
System.Data, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable.]

System.Runtime.Serialization.FormatterServices.Int ernalGetSerializableMembers(RuntimeType
type, Boolean excludeNonSerializable) +868

System.Runtime.Serialization.FormatterServices.Get SerializableMembers(Type
type, StreamingContext context) +300

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitMemberInfo()
+103

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize(Object
obj, ISurrogateSelector surrogateSelector, StreamingContext context,
SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
+493

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Object
obj, ISurrogateSelector surrogateSelector, StreamingContext context,
SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +48

System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Serialize(Object
graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
+683

System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream
serializationStream, Object graph, Header[] headers, Boolean fCheck)
+136

System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream
serializationStream, Object graph) +13
System.Web.Util.AltSerialization.WriteValueToStrea m(Object value,
BinaryWriter writer)

 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      03-07-2005
Putting it into SQL Server means having to serialize it and put it in a
database table. Storing it in memory means having to do absolutely nothing.

So, anything you put in session when using SQL server session state has to
be serializable. DataView is not. So you can't store it in Session if using
this session state model.

"jakk" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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
> non-serializable objects or MarshalByRef objects are not permitted when
> session state mode is 'StateServer' or 'SQLServer'
>
> [SerializationException: The type System.Data.DataView in Assembly
> System.Data, Version=1.0.5000.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089 is not marked as serializable.]
>
> System.Runtime.Serialization.FormatterServices.Int ernalGetSerializableMembers(RuntimeType
> type, Boolean excludeNonSerializable) +868
>
> System.Runtime.Serialization.FormatterServices.Get SerializableMembers(Type
> type, StreamingContext context) +300
>
> System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitMemberInfo()
> +103
>
> System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize(Object
> obj, ISurrogateSelector surrogateSelector, StreamingContext context,
> SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
> +493
>
> System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Object
> obj, ISurrogateSelector surrogateSelector, StreamingContext context,
> SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +48
>
> System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Serialize(Object
> graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
> +683
>
> System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream
> serializationStream, Object graph, Header[] headers, Boolean fCheck)
> +136
>
> System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream
> serializationStream, Object graph) +13
> System.Web.Util.AltSerialization.WriteValueToStrea m(Object value,
> BinaryWriter writer)
>



 
Reply With Quote
 
 
 
 
jakk
Guest
Posts: n/a
 
      03-08-2005
Thanks for the reply....I have started storing custom DataTable in
Session now that derives from ISerializable interface and implements
it.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to move from java object serialization to xml serialization? Dimitri Ognibene Java 4 09-02-2006 07:32 AM
Object serialization XML vs java serialization plasticfloor@gmail.com Java 3 06-14-2006 03:45 AM
Storing Session in SQL Server =?Utf-8?B?QWJoaWplZXQgS3VtYXI=?= ASP .Net 1 02-07-2006 02:00 PM
Storing Session State in SQL Server..Session doesnt Time out, jakk ASP .Net 2 03-08-2005 04:11 AM
Serialization Problems and books on serialization? sinleeh@hotmail.com Java 8 01-02-2005 02:40 PM



Advertisments