1

I Got below error while using session state SQL server with itextsharpt dll version 5.5.1.0. I am using asp.net 4.0 web application.

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.

I am using below configuration for session state

cookieless="AutoDetect" cookieName="MYCookie" mode="SQLServer" regenerateExpiredSessionId="false"

How can we Serialize third party dll like itextsharp.

Sam Peter
  • 71
  • 1
  • 9
  • Which iTextSharp objects do you want to serialize? There are a number of iTextSharp classes for which serialization does not make sense. – mkl Feb 27 '17 at 11:26
  • PdfSignatureAppearance objSign = (PdfSignatureAppearance)HttpContext.Current.Session["sap"]; above one is working fine with inproc session mode. but it's give an error as mentioned while using sql server session state. – Sam Peter Feb 27 '17 at 12:08
  • A `PdfSignatureAppearance` is depending on a `PdfStamper`, and serializing a stamper does not make sense as it depends on an output `Stream`. – mkl Feb 27 '17 at 12:26
  • I would say that the serialization is the PDF itself. – Paulo Soares Feb 27 '17 at 14:08
  • Depending on the state of the signature creation process, that may be possible. – mkl Feb 27 '17 at 14:10

0 Answers0