Solved

Non-Serializable and MarshalByRef Objects

Posted on 2004-03-26
2
1,109 Views
Last Modified: 2007-12-19
Hi All,

I'm working in an environment where Serialization is used.  While I basically understand why one would use Serialization, I don't really understand the programming specifics behind it.  I occasionally receive the following error as I build my pages, and don't understand what parts of my code cause it:

"Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'."

These errors SEEM to be related to my use of Session vatiables -- though I'm really not sure.

Does anyone out there have any idea of general guidelines to follow when programming in an environment where Serialization is used in order to avoid such errors.  Perhaps a link to an article?

Thanks much,

K
0
Comment
Question by:kaubey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
NotaClue earned 250 total points
ID: 10689204
Hi K,

It is related to your session variables, it is easily solved, if you have a session vaiable that is a clas you created, just add the
serializable attibute to at the beginning of the class declaration

<Serializable()> Public Class Yourclassname

This adds code behind the scenes to your class be serialized and thus usable with session state  'StateServer' or 'SQLServer'
the alternative, which doesn't seem to be an option here, is to change the session state to InProc, then you don't have to worry about serialization :)

as for articles go to google and search asp.net and serialization there are lot of articles, but here are a couple to get you started..

http://www.4guysfromrolla.com/webtech/012302-1.shtml

http://msdn.microsoft.com/msdnmag/issues/02/04/net/default.aspx

0
 

Author Comment

by:kaubey
ID: 10689428
Thanks NotaClue --  This info was exactly what I was looking for.  I wish I had the option to change the session state to InProc, but the powers that be lay down such laws:-)

Regards,

K
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question