Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Xsd, Xml and Serialization

Status
Not open for further replies.

ResolutionsNET

IS-IT--Management
Jul 31, 2000
70
GB
I wonder if anyone can help me.

I have used xsd to generate a c# class from an xml file.

This class is currently being used in my application and works perfectly ok when stored in InProc session.

But when moving to StateServer, it throws the "Unable to serialize the session state", now I know the reasons why it throws this error. But I have a very simple xml structure (and in turn a simply generated class).

Can anyone help me.

The XML structure is simple, i.e.


<AAAs>
<AAA Name="x" Type="y">
<BBB x="1" />
<CCC x="1" y="2"/>
<CCC x="2" y="3"/>
</AAA>
<AAA Name="x" Type="y">
<BBB x="1" />
<CCC x="1" y="2"/>
<CCC x="2" y="3"/>
</AAA>
</AAAs>


And I am loading it like this;


MmlSerializer serializer = new XmlSerializer(typeof(AAAs));

// Read in the XML document
FileStream fs = new FileStream( filepath )

// Declare an object variable of the type to be deserialized.

AAAs newobject


// Use the Deserialize method to restore the object's state with data from the XML document.
newobject = (AAAs)serializer.Deserialize(fs);

Session["AAAs"] = newobject;


Can anyone help, I'd really like to get this working with StateServer rather than InProc.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top