Hi,
I have one XML document which I want to store it inside ViewState so on each post back I do not need to load it from its physical path again. I do not want to store it in SessionState as well.
when I tried to srote it in ViewState I get an error:
Exception Details: System.Runtime.Serialization.SerializationException: Type 'System.Xml.XmlDocument' in Assembly 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
my property is something like this:
private XmlDocument MyDocument {
get
{
object viwObj = ViewState["MyDocument"];
if (viwObj != null)
return (XmlDocument)viwObj;
XmlDocument xmlDoc = GetMyDocument();
ViewState["MyDocument"] = xmlDoc;
return xmlDoc;
}
}
How can I make an xml document serializable then?
thanks