I\'m trying to store session state in SQL instead of InProc in our nopcommerce 1.9 install. When I make the requisite changes to the web.config I get this error:
As the exception says your Type
NopSolutions.NopCommerce.BusinessLogic.Categories.Category
is not serializable. I dont know the implementation of that type but you can try to decorate the type with the [Serializable]
attribute.
If you cant do this you can simply write the id of the object to your session.
If you want your session stored in sql server, every object your write into your session needs to be serializable.
Adding the [Serializable]
attribute (<Serializable()>
in VB) automatically makes your class serializable. All the members in your class need to be serializable too. So suppose there are object references in your class. Then the classes which those objects belong to need to have the [Serializable]
attribute too. Basic types are automatically serializable.