S
sdettmers
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 store the validated users DataRow into Session
which is in SQLServer. I have listed the error below for you to
review. I
can successfully store a DataRow on other pages. I don't understand
why it will work for one page and not the other.
The Error:
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'.
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.
Exception Details: System.Web.HttpException: 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'.
Source Error:
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.
Stack Trace:
[SerializationException: The type System.Xml.XmlBoundElement in
Assembly System.Data, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType
type, Boolean excludeNonSerializable) +868
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type
type, StreamingContext context) +300
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
+103
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Type
objectType, ISurrogateSelector surrogateSelector, StreamingContext
context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter
converter) +362
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Type
objectType, ISurrogateSelector surrogateSelector, StreamingContext
context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter
converter) +48
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo
objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +601
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object
graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
+738
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream
serializationStream, Object graph, Header[] headers, Boolean fCheck)
+136
System.Web.Util.AltSerialization.WriteValueToStream(Object value,
BinaryWriter writer) +1621
[HttpException (0x80004005): 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'.]
System.Web.Util.AltSerialization.WriteValueToStream(Object value,
BinaryWriter writer) +1710
System.Web.SessionState.SessionDictionary.Serialize(BinaryWriter
writer) +148
System.Web.SessionState.StateClientManager.Serialize(SessionStateItem
item, Stream stream) +146
System.Web.SessionState.SqlStateClientManager.System.Web.SessionState.IStateClientManager.Set(String
id, SessionStateItem item, Boolean inStorage) +126
System.Web.SessionState.SessionStateModule.OnReleaseState(Object
source, EventArgs eventArgs) +465
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
+60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +87
Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
ASP.NET Version:1.1.4322.2032
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 store the validated users DataRow into Session
which is in SQLServer. I have listed the error below for you to
review. I
can successfully store a DataRow on other pages. I don't understand
why it will work for one page and not the other.
The Error:
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'.
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.
Exception Details: System.Web.HttpException: 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'.
Source Error:
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.
Stack Trace:
[SerializationException: The type System.Xml.XmlBoundElement in
Assembly System.Data, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType
type, Boolean excludeNonSerializable) +868
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type
type, StreamingContext context) +300
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
+103
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Type
objectType, ISurrogateSelector surrogateSelector, StreamingContext
context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter
converter) +362
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Type
objectType, ISurrogateSelector surrogateSelector, StreamingContext
context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter
converter) +48
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo
objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +601
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object
graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
+738
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream
serializationStream, Object graph, Header[] headers, Boolean fCheck)
+136
System.Web.Util.AltSerialization.WriteValueToStream(Object value,
BinaryWriter writer) +1621
[HttpException (0x80004005): 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'.]
System.Web.Util.AltSerialization.WriteValueToStream(Object value,
BinaryWriter writer) +1710
System.Web.SessionState.SessionDictionary.Serialize(BinaryWriter
writer) +148
System.Web.SessionState.StateClientManager.Serialize(SessionStateItem
item, Stream stream) +146
System.Web.SessionState.SqlStateClientManager.System.Web.SessionState.IStateClientManager.Set(String
id, SessionStateItem item, Boolean inStorage) +126
System.Web.SessionState.SessionStateModule.OnReleaseState(Object
source, EventArgs eventArgs) +465
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
+60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +87
Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
ASP.NET Version:1.1.4322.2032