473,802 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
Nov 17 '05 #1
2 2141
> 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" <ni**********@h otmail.com> wrote in message
news:30******** *************** **@posting.goog le.com...
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.

Nov 17 '05 #2
Serialize objects can recreate themselves from the stream.

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

George.

"nick" <ni**********@h otmail.com> wrote in message
news:30******** *************** **@posting.goog le.com...
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.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3234
by: Drew | last post by:
Hello- I have am ASP.Net DataGrid object that I bind to from the result of a query. In order to not retrieve this dataset again when the user presses forward and back, I keep the dataset in a session variable: Session = dt; However, I have learned that if the user does not have cookies enabled, this does not work. Therefore, I have decided that if the
3
2034
by: Gordz | last post by:
I've been experiencing problems on some computers with XML Serialization. On some computers the files do not get created on the web server's hard drive and it's been driving me nuts trying to figure it out. I store navigation history and application state in object collections and save this upon application exit by doing an XML.Serialize. I'd like to serialize directly to SQL Server instead. Can I create a stream object to be used by...
2
3947
by: Dave | last post by:
We just started getting this error message in our application today (stack trace below). From the OutOfMemoryException, I'm guessing it could be a memory leak. I'm making sure I'm closing all my connections in the finally block but I'm not sure what I should be doing. As far as the "Unable to serialize the session state" error, this app has been running for days and this is the first I've seen this one as well. Any thoughts would be...
2
2041
by: Dave | last post by:
I have an application running on a 3 server webfarm running Windows 2003 with SQLServer Session state. After running for several hours, I started getting the following error. When I access each app individually, only one of the servers seems to return this error when I step through a sequence. I was told that I'm trying to store an object not marked as Serializable but I've tested this on a dev machine storing session variables without...
6
2169
by: py | last post by:
I want to serialize an object in jython and then be able to read it in using python, and vice versa. Any suggestions on how to do this? pickle doesnt work, nor does using ObjectOutputStream (from jython). I prefer to do it file based ...something like pickle.dump(someObj, open("output.txt", "w"))
1
1468
by: js | last post by:
Does anybody knows how to solve the problem? I added attribute to the following classes in Microsoft.Practices.EnterpriseLibrary.Data namespace, but I still get the error. Thanks. Database.cs DatabaseFactory.cs DatabaseProviderFactory.cs DBCommandWrapper.cs
1
39709
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same
6
492
by: tshad | last post by:
I had asked about this before, but have been unable to solve the problem. Could this be a problem with Web Services? I have 4 web services that I reference in this object. There is only one class. I have an object I am unable to put in my session. I have others that have no problem. The difference is the the one I am having problems with was created in VS 2003. The others were created using DW and compiling using the commandline...
3
3716
by: =?Utf-8?B?VG9ueSBTZXI=?= | last post by:
Come across an issue with IIS process HTTP request one by one, not simultaneously. I have a page that takes a long time to process. When the page is accessed by 2 seperate browser, both request will be processed the same time. But if the 2nd browser is opened by IE->File->New Window, when the 2 browsers try to access the same page, the requests are handle sequentially. Same behaviour with 2 firefox browser.
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10538
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10305
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9115
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.