Solved

Unable to Serialize Session State

Posted on 2013-12-10
5
280 Views
Last Modified: 2013-12-17
Created asp.net program on VS2012 desktop development system and it works fine.

When I move the program to our web server I get the error "Unable to Serialize Session State" when I run program.

I have two or three string session variables and one arraylist stored in session variable.
The array list data is a struct consisting of three strings.

Program has only one aspx form with vbcodebehind.

What do I need to do to make this work outside of vs2012  (Framework 2.0)

any help with vb examples would be appreciated.

Lee
0
Comment
Question by:trims30
  • 4
5 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 39710608
Check the Sessiona state setting on web server in config files . may be it is disabled.
Compare it with you local machine
0
 

Author Comment

by:trims30
ID: 39711123
I don't have any control of the server - it's a shared server I subscribe to.
Any other suggestions?
0
 

Author Comment

by:trims30
ID: 39711252
Code that causes error can be demonstrated by two subroutines below.
btnTA_Click saves an arraylist to session with no error
btnTS_Click saves an arraylist (Structure) to session and causes error.

Public Class _Default
    Inherits System.Web.UI.Page
    Structure HoursData
        Dim Project As String
        Dim Activity As String
        Dim Hours As String
    End Structure

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnTA_Click(sender As Object, e As EventArgs) Handles btnTA.Click
        Dim PinNumbers As New ArrayList
        PinNumbers.Add("1")
        PinNumbers.Add("2")
        PinNumbers.Add("3")
        Session("Pin") = PinNumbers  'THIS ARRAY IS SUCCESSFULLY SAVED TO SESSION
    End Sub

    Protected Sub btnTS_Click(sender As Object, e As EventArgs) Handles btnTS.Click
        Dim Dailywork As HoursData
        Dim Activities As New ArrayList
        Dailywork.Project = "Proj"
        Dailywork.Activity = "Act"
        Dailywork.Hours = "Hrs"
        Activities.Add(Dailywork)
        Session("Acts") = Activities 'THIS ARRAY CAUSES SERIALIZE ERROR WHEN SAVED TO SESSION
    End Sub
End Class

Open in new window

0
 

Accepted Solution

by:
trims30 earned 0 total points
ID: 39715368
had to rewrite and eliminated structures in arraylist.
All working OK now.
0
 

Author Closing Comment

by:trims30
ID: 39723500
cannot do anything to configure server since it's shared server
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now