-1

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
  • Can you please check that the datatype of data-members which are set as serializable? As some of the datatypes might not be serialized – Chirag Vidani Jan 28 '14 at 06:50
  • Some code please. Not all object even with Serializable, can be serialized, like the Dictionary. – Aristos Jan 28 '14 at 06:56

1 Answers1

0

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?

Community
  • 1
  • 1
Louis van Tonder
  • 3,664
  • 3
  • 31
  • 62
  • FYI, I have myself, found a workaround if I indeed needed to serialize an object.. de-serialize it later, using a stateserver. If you really need to do this, maybe start a new question, Re, how to serialize non serializable objects... don;t think it appropriate to add it to this question. – Louis van Tonder Jan 30 '14 at 09:30