Professional Web Applications Themes

Serialize Object in Session? - ASP.NET General

Is it recommended to serialize a custom object when putting it in session? I have a User object with properties ID, FirstName, LastName, and an array of Permissions which I would like to keep in session. Should I first serialize it to put it in session? I read that this is not necessary, but I'm wondering about memory usage and performance. I realize that serializing/deserializing the object will take time, but will the serialized object consume less memory than the non serialized object? If so, will it be significant. Thanks....

  1. #1

    Default Serialize Object in Session?

    Is it recommended to serialize a custom object when putting it in session?

    I have a User object with properties ID, FirstName, LastName, and an
    array of Permissions which I would like to keep in session. Should I
    first serialize it to put it in session? I read that this is not
    necessary, but I'm wondering about memory usage and performance. I
    realize that serializing/deserializing the object will take time, but
    will the serialized object consume less memory than the non serialized
    object? If so, will it be significant. Thanks.
    nick Guest

  2. #2

    Default Re: Serialize Object in Session?

    > Is it recommended to serialize a custom object when putting it in session?

    No.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Neither a follower nor a lender be.

    "nick" <com> wrote in message
    news:google.com... 


    Kevin Guest

  3. #3

    Default Re: Serialize Object in Session?

    Serialize objects can recreate themselves from the stream.

    So usually serialized representation of the object takes up more space than
    object itself.

    George.

    "nick" <com> wrote in message
    news:google.com... 


    George Guest

Similar Threads

  1. Replies: 5
    Last Post: November 8th, 02:59 PM
  2. Serialize object method to soap message?
    By RA in forum ASP.NET Web Services
    Replies: 0
    Last Post: April 29th, 02:29 AM
  3. Replies: 3
    Last Post: September 29th, 03:25 AM
  4. Session serialize format
    By John Smith in forum PHP Development
    Replies: 9
    Last Post: February 24th, 11:08 AM
  5. Cannot serialize the object using XmlSerializer
    By threecrans in forum ASP.NET Building Controls
    Replies: 0
    Last Post: September 25th, 01:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139