IIS 5 & IIS 6
Unable to serialize the session state - ASP.NET v2.0 -- Please Help
Last post Nov 25, 2009 04:30 PM by tomkmvp
Nov 25, 2009 02:15 PM|amissra|LINK
Hi, I'm a little new to asp.net and I'm not exactly sure how to tackle this problem.....
On the web application we're using, I'm essentially trying to print out data from a repeater in a panel out to a printer. In the web.config, we're using "StateServer" as the Session State.
The data I get for the repeater is from a set of operations I do to a mysql database... ie. a function collects data from a database.... I manipulate records for the database ..... **I keep track of what I manipulated**
The data I keep track of is what I send to the repeater to display a report. This report is what I'm trying to print out to a printer.
Oh, and the data binding for the repeater is done on Page_Load of the page itself.
The error I'm getting is this:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
[SerializationException: Type 'System.Web.UI.WebControls.Panel' in Assembly 'System.Web, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.] System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +7733643 System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +258 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +111 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +161 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +51 System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header inHeaders, __BinaryWriter serWriter, Boolean fCheck) +410 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header headers, Boolean fCheck) +134 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) +13 System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer) +2560[HttpException (0x80004005): 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.] System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer) +2729 System.Web.SessionState.SessionStateItemCollection.WriteValueToStreamWithAssert(Object value, BinaryWriter writer) +55 System.Web.SessionState.SessionStateItemCollection.Serialize(BinaryWriter writer) +1271 System.Web.SessionState.SessionStateUtility.Serialize(SessionStateStoreData item, Stream stream) +314 System.Web.SessionState.SessionStateUtility.SerializeStoreData(SessionStateStoreData item, Int32 initialStreamSize, Byte& buf, Int32& length) +101 System.Web.SessionState.OutOfProcSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +107 System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +853 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +216 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +120
I realize that if I change the web.config sessionState control to "InProc", that what I'm trying to do does function.... but that's NOT how the web application was designed... It's specifically designed for "StateServer", and I cannot change that.... also,
I further realize that something, is being sent back that is NOT serialized.... according to the stack that is 'System.Web.UI.WebControls.Panel' ....
Any help on this would be much appreciated... I really don't know what to do to fix this...
Nov 25, 2009 02:31 PM|Paul Lynch|LINK
Refer to this thread for an explanation of this behaviour :
Nov 25, 2009 02:43 PM|amissra|LINK
Thanks for replying. I've read that post before, and that doesn't really help. I have "StateServer" in the web.config file, and I've been told to leave it as that. I can't go to "InProc", which is why I mentioned that earlier.
Nov 25, 2009 04:30 PM|tomkmvp|LINK
This is a question best suited for http://forums.asp.net/ ...