views:

60

answers:

1

I was wondering if the following error,

System.Web.HttpException: 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

was caused by not serialising properties.

Any ideas?

Thanks

+3  A: 

When you use a StateServer or SQL Server session state all objects you store in session must be serializable. For your own classes this can often be easily fixed by marking them with the [Serializable] attribute, but for classes delivered by third-parties there is no trivial fix.

If you keep running into this problem you may consider rebuilding your data on each request instead of using session state at all, but that is another discussion... :-)

Rune Grimstad