System.Web.UI.WebControls + SqlServer Session State


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: System.Web.UI.WebControls + SqlServer Session State

  1. #1
    Join Date
    Feb 2004
    Posts
    111

    System.Web.UI.WebControls + SqlServer Session State

    I'm working on an application where a fair amount of data is being stored in the page's viewstate. As the project has progressed, the performance of the page really started to degrade. So, to correct the project, we started storing the page's viewstate in a session object on the server.

    Unfortunately, when we started doing this we started getting the following error:

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

    After looking at (and for) the error we are stumped! It seems that there is a web control that just won't serialize. However, if I'm reading the details of the error then it's one of Microsoft's own!

    Any help to solve this problem is greatly appreciated!

    The details of this error

    [SerializationException: The type System.Web.UI.WebControls.WebControl in Assembly System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a is not marked as serializable.]
    System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type, Boolean excludeNonSerializable) +965
    System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +300
    System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +103
    System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +493
    System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +48
    System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +683
    System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +136
    System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) +13
    System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer)

  2. #2
    Join Date
    May 2005
    Location
    UK
    Posts
    278
    Do you know which control on your page is the WebControl that wouldnt serialize
    and Are you using any custom server controls which derive from the WebControl class ?

    I hope you guys do realise your server load is going to be high with the viewstate information in your session.. You could have considered caching selectively Anyway let me know
    Sri

  3. #3
    Join Date
    May 2005
    Location
    UK
    Posts
    278
    Another thought on this case,
    we use View state normally to avoid going back to the database and handling event data across postbacks and other reasons,
    Now when use session to store viewstate information I was kind of ok with it,

    but then when you said you are using SQL Server Session State management to manage viewstate , you are basically going back to the database

    In which case you might as well query your actual database and get more reliable up to data data? than sending viewstate to session in a SQL Server state implementation

    I am not sure in the first place if you are using SQL Server State management or ASp.Net State Service, but seems like your web.config is set to one of these , if you didnt intend to use one of these I guess your session setting should say InProc ?
    Sri

  4. #4
    Join Date
    Feb 2004
    Posts
    111
    We're still trying to track down the errant control (or controls). But, save tearing apart the form and then putting it back together (one piece at a time), I'm not sure how we are going to find it.

  5. #5
    Join Date
    May 2005
    Location
    UK
    Posts
    278
    Are you using SQL Server session state management? or asp.net state service to do this job? or InProc session i can infer what the error says but is it that you guys intend to use?
    Sri

Similar Threads

  1. Replies: 1
    Last Post: 01-19-2002, 02:09 PM
  2. Replies: 0
    Last Post: 01-17-2002, 06:28 PM
  3. Replies: 2
    Last Post: 08-12-2000, 12:47 PM
  4. ASP+ session state management
    By Ariel Azia in forum ASP.NET
    Replies: 3
    Last Post: 08-02-2000, 01:10 AM
  5. more ASP+ session state management info
    By Ariel in forum ASP.NET
    Replies: 3
    Last Post: 08-01-2000, 12:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center