I have a class that is marked as serializable and stores it in a session without problems, but when I try to save it in ViewState, I get:
Sys.WebForms.PageRequestManagerServerErrorException: error serialization value
The reason is that serialization of view state is performed by the LosFormatter class, and session serialization is performed using the BinaryFormatter . The two are subtly different from each other, and one of these subtle differences is probably causing your problem.
LosFormatter
BinaryFormatter
Check out this article and documentation for LosFormatter to see if you can find some clues about what is causing your problem.
Well, it also depends on which session you are using. If it is in-proc, serialization does not occur at all. Your objects are stored in memory.