esong2

esong2

  • NA
  • 1
  • 0

ASP.NET deserialization problem! Please HELP!

Dec 19 2004 9:47 PM
Hi, I've declare a ISerializable class and I'm able to serialize and deserialize it ONLY if I don't modify the aspx file again. If I simply re-save the aspx file (even if not modifying anything), I would get "Specified cast is not valid." error during deserialization. I suspect the problem is with "ClassToSerialize c=(ClassToSerialize)b.Deserialize(ms2)" but I do not have the solution. From the error it looks like casting problem but how come it worked the first time? Please help! Here is the full code and the database is MSSQL. <%@ Page Language="C#" EnableViewState="false" %> <%@ import Namespace="System.IO" %> <%@ import Namespace="System" %> <%@ import Namespace="System.Runtime.Serialization" %> <%@ import Namespace="System.Runtime.Serialization.Formatters.Binary" %> <%@ import Namespace="System.Data.SqlClient" %> <%@ import Namespace="System.Data" %>

Thanks. ES