I am using jqGrid control in an ASP.NET application. Export to Excel feature is giving me troubles. Code is going into a load balanced environment, therefore, I am saving session state to SQL. This requires anything dumped into session to be serialized. Can anyone help me determine how to get around this?
It is blowing up here:
if (JQGrid.AjaxCallBackMode != AjaxCallBackMode.None)
{
//save the last grid state in session – to be used for exporting
Session[“gridFilterPageState”] = JQGrid.GetState();
}
This is the error:
Unable to serialize the session state. In ‘StateServer’ and ‘SQLServer’ mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in ‘Custom’ mode.
Have you thought about a solution where you put your state in a globaly shared object, identified by an ID, and store your ID in the Session State? Of course you would have to deal with some Locks, but if I cannot serialize something, but need it across requests for just ONE user, i make a shared holder, some dictionary (ID, OBJECT) or something, and save the ID in the session.