Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. serialization

serialization

Scheduled Pinned Locked Moved ASP.NET
jsonquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kanjinghat
    wrote on last edited by
    #1

    Dear All, can i serialize an aspx page object? not the code behind class but the page object itrself thanks in advance

    Ramesh.Kanjinghat

    C 1 Reply Last reply
    0
    • K 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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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 )

      K 1 Reply Last reply
      0
      • C Christian Graus

        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 )

        K Offline
        K Offline
        Kanjinghat
        wrote on last edited by
        #3

        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 call GetSerialized(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 regards

        Ramesh.Kanjinghat

        C 1 Reply Last reply
        0
        • K 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 call GetSerialized(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 regards

          Ramesh.Kanjinghat

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          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 )

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups