Serialization Exception

Last post 07-02-2010, 8:40 PM by cutechat. 1 replies.
Sort Posts: Previous Next
  •  07-02-2010, 10:20 AM 62248

    Serialization Exception

    I have the Session management set to Sql Server in IIS for my application that uses the ajax uploader control.  It is erring out doing the uploader and I believe it is happening on the line of code where I set a Session variable to the args of type UploaderEventArgs.  Here is the code:
     
     

    Protected Sub Attachments1_FileUploaded(ByVal sender As System.Object, ByVal args As CuteWebUI.UploaderEventArgs) Handles Attachments1.FileUploaded

    Session("UploadFile") = args

    propFilename = args.FileName

    validRequest = True

    btnContinue.Enabled = True

    End Sub

     
     
    And here is the exception from event viewer:

    Exception information:

    Exception type: SerializationException

    Exception message: Type 'CuteWebUI.UploaderEventArgs' in Assembly 'CuteWebUI.AjaxUploader, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bc00d4b0e43ec38d' is not marked as serializable.

  •  07-02-2010, 8:40 PM 62254 in reply to 62248

    Re: Serialization Exception

    Hi,
     
    The UploaderEventArgs is a temporary object, you shall not save it to Session.
     
    You can save the args.FileGuid instead.
     
    and use
     
    new MvcUploader(HttpContext).GetUploadedFile
     
    to get the file object
     
    Regards,
    Terry
     
     
View as RSS news feed in XML