views:

818

answers:

2

I have a class that is marked as serializable and have no problem storing it in the Session but when I attempt to save it in the ViewState I get:

Sys.WebForms.PageRequestManagerServerErrorException: Error serializing value

A: 

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.

Ronald Wildenberg
A: 

Well it also depends what kind of session do you use. If it's in-proc, then serialization doesn't take place at all. Your objects get stored into memory.

Robert Koritnik