Advertisement

07.03.2008 at 02:08PM PDT, ID: 23538208
[x]
Attachment Details

Saving Dictionary to Session state

Asked by knowlton in Programming for ASP.NET

I am saving the Dictionary to a Session variable, but when I leave the method, I get this error:

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.


HERE IS THE METHOD:


    protected void GridViewAssignedUserSkills_RowDataBound(object sender, GridViewRowEventArgs e)
    {        
        UserSkillChanges usc = new UserSkillChanges();

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataRowView drv = (DataRowView)e.Row.DataItem;
           
            usc.SkillID = Int32.Parse(drv["skill_id"].ToString());
            usc.SkillLevel = Int32.Parse(drv["skill_level"].ToString());
            usc.SkillStateID = Int32.Parse(drv["skill_state_id"].ToString());
            usc.UserSkillID = Int32.Parse(drv["user_skill_id"].ToString());
            usc.UserID = Int32.Parse(drv["user_id"].ToString());

            userSkillsDictionary.Add(usc.SkillID, usc);

            Session["sessionUserSkillsDictionary"] = userSkillsDictionary;
        }
    }
}



Start Free Trial
[+][-]07.03.2008 at 02:44PM PDT, ID: 21929477

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Programming for ASP.NET
Sign Up Now!
Solution Provided By: squillman
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906