By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,241 Members | 775 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,241 IT Pros & Developers. It's quick & easy.

Storing Session in Sql Server Serialization exception

P: n/a
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)

Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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" <rj******@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr 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)

Nov 19 '05 #2

P: n/a
Thanks for the reply....I have started storing custom DataTable in
Session now that derives from ISerializable interface and implements
it.

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.