serialization
-
Dear All, can i serialize an aspx page object? not the code behind class but the page object itrself thanks in advance
Ramesh.Kanjinghat
-
Dear All, can i serialize an aspx page object? not the code behind class but the page object itrself thanks in advance
Ramesh.Kanjinghat
The page itself is just text, so of course you can serialise it. The HTML that the page generates is also just text, so you can serialise that, too.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
The page itself is just text, so of course you can serialise it. The HTML that the page generates is also just text, so you can serialise that, too.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
childpage.aspx is my aspx page.
private static string GetSerialized(object objToSerialize) { BinaryFormatter bFormatter = new BinaryFormatter(); MemoryStream mStream = new MemoryStream(); byte[] brTemp; string strSerializedObject; try { bFormatter.Serialize(mStream, objToSerialize); brTemp = mStream.ToArray(); strSerializedObject = Convert.ToBase64String(brTemp); return strSerializedObject; } catch(Exception ex) { return null; } finally { bFormatter = null; mStream = null; brTemp = null; } }
the above method helps me to serialize the objects. when i callGetSerialized(this)
in my aspx page it is throwing the below exception ex {"Type 'ASP.childpage_aspx' in Assembly 'App_Web_wzfanznh, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable."} System.Exception {System.Runtime.Serialization.SerializationException} do you have any idea about this? thanks and regardsRamesh.Kanjinghat
-
childpage.aspx is my aspx page.
private static string GetSerialized(object objToSerialize) { BinaryFormatter bFormatter = new BinaryFormatter(); MemoryStream mStream = new MemoryStream(); byte[] brTemp; string strSerializedObject; try { bFormatter.Serialize(mStream, objToSerialize); brTemp = mStream.ToArray(); strSerializedObject = Convert.ToBase64String(brTemp); return strSerializedObject; } catch(Exception ex) { return null; } finally { bFormatter = null; mStream = null; brTemp = null; } }
the above method helps me to serialize the objects. when i callGetSerialized(this)
in my aspx page it is throwing the below exception ex {"Type 'ASP.childpage_aspx' in Assembly 'App_Web_wzfanznh, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable."} System.Exception {System.Runtime.Serialization.SerializationException} do you have any idea about this? thanks and regardsRamesh.Kanjinghat
I can't think of a single sensible reason to want to do this. However, seeing as the page class simply generates HTML, I would think that if you want to store a page, storing the HTML would suffice.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )