Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode

Jan 25, 2011 at 4:27 PM
Edited Jan 25, 2011 at 4:32 PM

Hi

This is a great contribution, thank you very much.

In an application with SQLServer Session, I get error when provide mForm input , the error is as follows:

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. 

How can fix it?

Regards

Coordinator
Jan 25, 2011 at 6:11 PM

I have several questions to you, that will let me better understand the problem that you are facing:

1) Which MForm version are you using? Is it the version taken from the downloads (the public beta 1 version) or did you download the latest source code version?

2) Does your problem vanish when using standard inproc session?

If you use the beta version and the problem does not exist when using InProc, then I suppose the problem is with the piece of code that I removed in revision 40533 - http://mform.codeplex.com/SourceControl/changeset/changes/40533

There was a pretty ugly piece of code that kept xml nodes not read into the form in the session so that after the postback they could be added back to the output from the form. The merged xml was then available using the OutputXmlWithLeftNodes property. This code however was not very safe and relied on using the session, thus it was removed.

To fix your problem, you can download the last version of MForm source at https://mform.svn.codeplex.com/svn/trunk/Solutions/MForm . You can do it for example by using TortoiseSvn.

I also have to admit that for quite a long time I did not commit any changes to the project, even though many critical improvements were added to and around the library. I did not have enough time to synchronize the public version with the version we use at work, but if you are interested, I believe I could find some time and update the sources at codeplex and also explain the changes.