Microsoft Knowledge Base Email Alertz

KBAlertz.com: (312112) - When you use SQLServer session state mode, if you try to store an instance of a class that is not marked as serializable into a session variable, the request returns without an error. However, ASP.NET actually fails to save the session data and blocks...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **


Community Site



We Send hundreds of thousands of emails using ASP.NET Email


ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 312112 - Last Review: August 3, 2003 - Revision: 3.2

BUG: Session Data Is Not Saved in Out-of-Process Session State

This article was previously published under Q312112

SYMPTOMS

When you use SQLServer session state mode, if you try to store an instance of a class that is not marked as serializable into a session variable, the request returns without an error. However, ASP.NET actually fails to save the session data and blocks subsequent requests in the same session.

This same behavior occurs when you use StateServer session state mode, but you also receive the following run-time error:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.Serialization.SerializationException: The type <namespace.classname> in Assembly <AssemblyName>, Version=1.0.676.30211, Culture=neutral, PublicKeyToken=null is not marked as serializable.
When session state is configured to be stored in Microsoft SQL Server, the thread that processes your request hangs, and the TempGetStateItemExclusive stored procedure in the ASPState database is called continuously with the same values in one-second increments. If session state is set to InProc, everything works as expected.

CAUSE

This problem occurs because the class is not marked as serializable.

RESOLUTION

To resolve this problem, add the [Serializable] attribute to mark the class as serializable. For example, use the following Microsoft Visual C# .NET code:
[Serializable]
public class MyClass
{
  //class code
}
				
Or use the following Microsoft Visual Basic .NET code:
<Serializable()> _
   Public Class MyClass
     'Class code
   End Class
				
Note If the class uses other classes, you must mark each class as serializable. The problem in this article also occurs with some Microsoft .NET Framework classes such as the XmlDocument class. These classes cannot be marked as serializable, so the error will still occur.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This bug was fixed in ASP.NET (included with the .NET Framework) 1.1.

APPLIES TO
  • Microsoft ASP.NET 1.0
Keywords: 
kbbug kbnofix kbreadme kbstate KB312112
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please