Unable to serialize the session state

T

tshad

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 and they work fine.

The error I am getting is:

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'.

The start of the code is:

namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>

[Serializable]
public class NewHire
{

Why won't this work?

Thanks,

Tom
 
G

Guest

Doesn't that message "Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'." explain it?

Regards,
Pandurang
 
E

Eliyahu Goldin

Make sure that all classes used in the implementation of NewHire also marked
as [Serializable].

Eliyahu
 
T

tshad

There is only one class. There are a bunch of methods, but only one class.

******************************
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;
using ClassLibrary4.RemoteUser;
using ClassLibrary4.NewHire;
using ClassLibrary4.EmployeeTax;
using MyFunctions;

namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>

[Serializable]
public class NewHire
{
private string companyNumber = "999999";
private string ssn = "";
private string dob = "";

....

public string SessionID
{
get { return sessionID; }
set { sessionID = value; }
}
}
}
******************************************************************

Tom


Eliyahu Goldin said:
Make sure that all classes used in the implementation of NewHire also
marked as [Serializable].

Eliyahu

tshad said:
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 and they work fine.

The error I am getting is:

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'.

The start of the code is:

namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>

[Serializable]
public class NewHire
{

Why won't this work?

Thanks,

Tom
 
T

tshad

Pandurang Nayak said:
Doesn't that message "Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode
is
'StateServer' or 'SQLServer'." explain it?

Not to me. I have it marked as non-serializable (as are other classes I
use). I don't know what MarshalByRef or if that is my problem.

Tom
Regards,
Pandurang
--
blog: www.thinkingMS.com/pandurang


tshad said:
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 and they work fine.

The error I am getting is:

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'.

The start of the code is:

namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>

[Serializable]
public class NewHire
{

Why won't this work?

Thanks,

Tom
 
T

Trevor Braun

Usually when I run into this it's because my class has events that have not
been marked NonSerializable().

HTH
Trevor B

tshad said:
There is only one class. There are a bunch of methods, but only one
class.

******************************
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;
using ClassLibrary4.RemoteUser;
using ClassLibrary4.NewHire;
using ClassLibrary4.EmployeeTax;
using MyFunctions;

namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>

[Serializable]
public class NewHire
{
private string companyNumber = "999999";
private string ssn = "";
private string dob = "";

...

public string SessionID
{
get { return sessionID; }
set { sessionID = value; }
}
}
}
******************************************************************

Tom


Eliyahu Goldin said:
Make sure that all classes used in the implementation of NewHire also
marked as [Serializable].

Eliyahu

tshad said:
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 and they work fine.

The error I am getting is:

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'.

The start of the code is:

namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>

[Serializable]
public class NewHire
{

Why won't this work?

Thanks,

Tom
 
T

tshad

Trevor Braun said:
Usually when I run into this it's because my class has events that have
not been marked NonSerializable().

Right.

But in my case, I am not using this and have specifically marked it as
Serializable, which is why I am confused.

Thanks,

Tom
HTH
Trevor B

tshad said:
There is only one class. There are a bunch of methods, but only one
class.

******************************
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;
using ClassLibrary4.RemoteUser;
using ClassLibrary4.NewHire;
using ClassLibrary4.EmployeeTax;
using MyFunctions;

namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>

[Serializable]
public class NewHire
{
private string companyNumber = "999999";
private string ssn = "";
private string dob = "";

...

public string SessionID
{
get { return sessionID; }
set { sessionID = value; }
}
}
}
******************************************************************

Tom


Eliyahu Goldin said:
Make sure that all classes used in the implementation of NewHire also
marked as [Serializable].

Eliyahu

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 and they work fine.

The error I am getting is:

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'.

The start of the code is:

namespace MyFunctions
{
/// <summary>
/// Summary description for Class1.
/// </summary>

[Serializable]
public class NewHire
{

Why won't this work?

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top