Asp.net State Server Unable to Serialize Session State

1k views Asked by At

I am using StateServer session,made all object [Serializable] ,still getting error.What was the problem?

Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

Here's the code...getting error on Response.Redirect("common/TicklerDisplay

Private Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
    Try
        SetOffset()
        strUserName = txtEmaillAdd.Text.Trim
        strPassword = txtPassword.Text.Trim



        Dim strSubscriptionLogin() As String = CCommon.ToString(ConfigurationManager.AppSettings("SubscriptionManagement")).Split("/")
        If strSubscriptionLogin.Length = 2 Then
            If strSubscriptionLogin(0) = strUserName And strSubscriptionLogin(1) = strPassword Then
                Session("DomainID") = 1
                Session("UserContactID") = 1
                Session("PagingRows") = 20
                Session("DateFormat") = "DD/MONTH/YYYY"

                Response.Redirect("Service/frmSerNav.htm", False)
                Exit Sub

            End If
        End If

        If sb_GetDomainUser() = False Then
            Session.Abandon()
            Exit Sub
        End If
    Catch ex As Exception
        ExceptionModule.ExceptionPublish(ex, Session("DomainID"), Session("UserContactID"), Request)
        Response.Write(ex)
        Session.Abandon()
        Exit Sub
    End Try

    If GetQueryStringVal("From") = "Help" Then
        Dim HelpURL As String = ConfigurationManager.AppSettings("HelpURL")

        HelpURL = HelpURL & "?a=" & objCommon.Encrypt(Session("AccessID")) & "&pageurl=" & CCommon.ToString(GetQueryStringVal("pageurl"))
        Response.Redirect(HelpURL)
        Exit Sub
    Else
        Response.Redirect("common/TicklerDisplay.aspx?ClientMachineUTCTimeOffset=" & txtOffset.Text.Trim)
        'HttpContext.Current.ApplicationInstance.CompleteRequest()
    End If
    'Response.Redirect("include/frmMenu.aspx")
End Sub
1

There are 1 answers

1
Louis van Tonder On BEST ANSWER

Check your Stacktrace where it throws the error. It should tell you excatly which object it cant serialize. As per the comments above, not all object can be serialized.

See: How can I find which object in ASP.NET can't be serialized?