http://stackoverflow.com/questions/925553/cannot-serialize-object-to-viewstate-only-session
The reason is that view state serialization is done by the LosFormatter
class while session serialization is done by the BinaryFormatter
class. The two are subtly different and one of these subtle differences is probably causing your problem.
Take a look at this article and the documentation for LosFormatter
to see if you can find some clues about what is causing your problem.
http://msdn.microsoft.com/en-us/library/bb738446.aspx
Because entity types support binary serialization, objects can be saved in the view state of an ASP.NET application during a postback operation. When required, the object and its related objects are retrieved from the view state and attached to an existing object context.