Monday, 7 June 2010

Using Session State in SharePoint 2010

Problem: I have setup session state but when I try add a custom object (class instance) to me ASP.NET session state (SQL) I get an error "unable to serialize the session state. in 'stateserver' and 'sqlserver' mode asp.net will serialize".
Initial Hypothesis:
I am adding a class to my session state
Client Instance = new Client("Paul", "Male");
HttpContext.Current.Session["ASPNETSession"] = Instance;
The Client class is not marked as Serializable

Resolution:
Mark the "Client" class as [Serializable]
http://dotnetguts.blogspot.com/2009/06/steps-for-session-inproc-mode-to.html

0 comments:

Post a comment