I’m trying to store object of Employee in Session (DB Based), When i do this I’m getting serialization error “Unable to serialize the session state. In ‘StateServer'”
[Serializable]
public class Employee
{
...
public List<System.ComponenetModel.DataAnnotation.ValidationResult> MyValidationResult
{ get; set; }
}
I figured out it is happening when it tries to serialize MyValidationResult it is happening, Any idea how to fix it ?
You could use the
NonSerializedAttribute. Add a backing field and don’t use an auto-implemented property and add the NonSerializedAttribute to the field and you should be good to go.