My thoughts regarding ASP.NET, C#, programming practices, and more...
reading
You Should Read archives
blogs I read
|
Friday, May 27, 2005Serializable
Problem
Content copyright ©2003-2006 Tod Birdsall
I was trying to add a custom collection of business entities/objects to the Session using the following code: Session["MatchingFiles"] = files; When I opened the aspx page that called the above code I received the following error message:
OK, no problem. I will just add [Serializable] to the top of both the custom collection and business object class declarations. After doing this, I refreshed the aspx page and received the same error message. Solution It took some doing, but I finally realized that both of these classes inherit from base classes. Neither of these base classes were marked serializable. Once I added [Serializable] to the base classes, the custom collection was able to be stored in Session state. |