Unable to serialize a class using State server mode
<p>I have an asp.net web api application :</p>

<p><strong>Web.config</strong> </p>

<pre><code>&lt;system.web&gt;
     &lt;sessionState mode="StateServer" timeout="1500" /&gt;
    &lt;authentication mode="None" /&gt;
    &lt;compilation debug="true" targetFramework="4.5" /&gt;
    &lt;httpRuntime targetFramework="4.5" /&gt;
    &lt;globalization culture="fr-FR" uiCulture="fr" /&gt;
  &lt;/system.web&gt;
</code></pre>

<p><strong>In Controller</strong></p>

<pre><code>ITaigaTimeSheet itaiga;

public TaigaApiController()
{
    if (HttpContext.Current.Session["taigaclass"] == null)
    {
        string mail = (string)HttpContext.Current.Session["User_mail"];
        HttpContext.Current.Session["taigaclass"] = new TaigaTimeSheet(mail);
    }
    itaiga = (TaigaTimeSheet)HttpContext.Current.Session["taigaclass"];
}
</code></pre>

<p><strong>In BLL</strong></p>

<pre><code>[Serializable()]
public partial class TaigaTimeSheet : ITaigaTimeSheet
{
    ITaigaClient client = null;
    Itimesheet SabCruder = null;
    ICrud&lt;vw_sab_client_affaire&gt; cruder = null;
    List&lt;Project&gt; taigaProjets = new List&lt;Project&gt;();
    List&lt;Member&gt; taigaMembers = new List&lt;Member&gt;();
    List&lt;vw_sab_client_affaire&gt; client_affaires = new List&lt;vw_sab_client_affaire&gt;();
    List&lt;vw_sab_client_affaire&gt; All_client_affaires = new List&lt;vw_sab_client_affaire&gt;();
    public TaigaTimeSheet()
    {
        client = new TaigaClient();
        client.GetMembersAndProjects(ref taigaProjets, ref taigaMembers);
        SabCruder = new Timesheet();
        cruder = new Crud&lt;vw_sab_client_affaire&gt;("stblinked");
        client_affaires = cruder.GetAll().ToList();
        All_client_affaires = cruder.GetAll().ToList();
    }
}
</code></pre>

<p>I need to store an instance of class <code>TaigaTimeSheet</code> as a session variable using <code>StateServer</code> mode.</p>

<p>But I get this exception :</p>

<blockquote>
  <p>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.</p>
</blockquote>

<p>So I need to know :</p>

<ol>
<li>How can I fix this?</li>
<li>What is the reason of this error?</li>
</ol>

<p>Thanks,</p>