Cry about...
MS-Windows Troubleshooting

Server Error in '/<folder>' ... Type TTTT not marked as serializable


When trying to run a .NET web-application the following error is generated in the browser:

Server Error in '/<folder>' The type TTTT is not marked as serializable.

where the type "TTTT" indicates the name of the class (or structure) of the object which is causing the problem.


When ASP.NET has tried to serialize an object this has failed, because the object cannot be serialised.

The most likely situation where this can occur is when saving session data. Here the error is not generated when saving the object to the session, but after the user code has finished executing and the framework attempts to save each of the session objects for later retrieval.

Possible Remedies:

  • If the web.config file is not set to store the sessionState InProc then change it to InProc. (See also "How to decide which method to use to store session information.") This avoids the problem if the problem relates to session information, but is less than ideal because there may be good reasons for wanting to use State Server or SQL Server for storing session information.
  • Identify the class causing the problem and then mark its definition as serializable,

    For C#:

    public class ...

    For VB.Net:

    <Serializable>public class ...

    See also Microsoft Knowledge Base article KB312112.

  • Use a surrogate class. The basic idea here is that you create a surrogate class that does the serialisation for you and allows you to control the serialisation process. For details see

These notes have been tested within Microsoft Visual Studio .NET 2003 running under Windows 2000 and XP, and may apply to other versions as well.

About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.