472,962 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,962 software developers and data experts.

Storing Session in Sql Server Serialization exception

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
2 4976
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Harris Boyce | last post by:
Hello, I'm trying to use the FOR XML EXPLICIT clause with SQL Server to deserialize data from my database into a strongly-typed collection object that I will use throughout my application. I...
13
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data...
4
by: kanones | last post by:
I have some data that is been retrieved from a call to sql server stored procedure that I want to store for a period of time in a web farm architecture. I want to minimize the calls to sql server...
5
by: sdettmers | last post by:
Hi, Database: SQL Server Session: SQL Server Language: C# Application: ASP.Net I have created a login page which attempts to retrieve the users record from the database and I...
1
by: js | last post by:
Does anybody knows how to solve the problem? I added attribute to the following classes in Microsoft.Practices.EnterpriseLibrary.Data namespace, but I still get the error. Thanks. ...
8
by: rgparkins | last post by:
Hi I am creating a sign-up process on a web site much like that of a wizard form. I have browsed many sites to look for examples of how to store the entry data, so that the user can go back and...
1
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In...
10
by: Mark Rae | last post by:
Hi, This relates to the previous thread "Disappearing Sessions", but is a bit more generic so I thought I'd start a new thread. This one relates to the storing of objects in Session once only to...
3
by: RSH | last post by:
Hi, I have a situation where I have created an object that contains fields,properties and functions. After creating the object I attempted to assign it to a session variable so i could retrieve...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.