Harshal Thakre

Harshal Thakre

  • 1.5k
  • 241
  • 77.6k

Unable to serialize the session state using asyncfileupload.

Jan 12 2017 5:50 AM
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.

Note: I am using State Server mode. and trying to store Control in session:-
 
if (asyUpldOffer.HasFile)
{
string contentType = asyUpldOffer.ContentType;
if (contentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || contentType == "application/pdf" || contentType == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || contentType == "application/msword" || contentType == "image/jpeg" || contentType == "image/jpg")
{
Session["UploadOffer"] = asyUpldOffer;
}
else
{
Session["UploadOffer"] = null;
}
}

Answers (1)