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
_RowDataBo
und(object
sender, GridViewRowEventArgs e)
{
UserSkillChanges usc = new UserSkillChanges();
if (e.Row.RowType == DataControlRowType.DataRow
)
{
DataRowView drv = (DataRowView)e.Row.DataIte
m;
usc.SkillID = Int32.Parse(drv["skill_id"
].ToString
());
usc.SkillLevel = Int32.Parse(drv["skill_lev
el"].ToStr
ing());
usc.SkillStateID = Int32.Parse(drv["skill_sta
te_id"].To
String());
usc.UserSkillID = Int32.Parse(drv["user_skil
l_id"].ToS
tring());
usc.UserID = Int32.Parse(drv["user_id"]
.ToString(
));
userSkillsDictionary.Add(u
sc.SkillID
, usc);
Session["sessionUserSkills
Dictionary
"] = userSkillsDictionary;
}
}
}
Start Free Trial