Support forums

Session variable cleared after Upload

Last post 07-13-2009, 4:06 PM by sancho. 3 replies.
Sort Posts: Previous Next
  •  07-11-2009, 6:19 PM 53909

    Session variable cleared after Upload

    I have an application that handles files. The files require some extra information for further processing. I'm using this control for file uploading:
    1. <CuteWebUI:UploadAttachments ID="Uploader1" runat="server"    
    2.     MaxFilesLimit="100" InsertButtonID="btnBrowse" ValidateOption-MaxSizeKB="10240"    
    3.         Visible="True" onattachmentadded="Uploader1_AttachmentAdded"    
    4.     MultipleFilesUpload="False" OnFileValidating="Uploader1_FileValidating"  
    5.     TempDirectory="/TempFiles">   
    6. </CuteWebUI:UploadAttachments>  
    On the OnAttachmentAdded event I create a new custom object (that contains the file in bytes and the extra information). This new object is added to a a session variable of type List<MyCustomType>. This list most be kept for the later processing.
    The problem is that after uploading a few files I get the error "Thread was being aborted", and the session variable List<MyCustomType> is cleared (the files in the Uploader are kept).
    Can you please help me?
  •  07-11-2009, 9:37 PM 53910 in reply to 53909

    Re: Session variable cleared after Upload

    Can you post your code ?
    Is your code using Response.End() ?
  •  07-13-2009, 11:43 AM 53930 in reply to 53910

    Re: Session variable cleared after Upload

    I forgot to mention something VERY important (sorry I was in a rush :p), my code is in a WebUserControl in a WebPart in Sharepoint (wss 3.0 with ajax enabled). Is in the CreateChildControls method of the webpart tha the error occurs. The same error occurs when there's a redirect, but the session variables are not lost. Something I found out is that the error is related to files of certain size. I successfully uploaded several files of 168KB and smaller, but with files from 202KB and bigger, the session variable is cleared.


    And nope, I'm not using Response.End() :)


    Any ideas?

  •  07-13-2009, 4:06 PM 53945 in reply to 53930

    Re: Session variable cleared after Upload

    Hi. A friend figured a workaround for my code so I won't be needing the session variable. I couldn't solve the problem, but thanks for replying :)

    If you're still curious about this, let me know and I'll send you the code.

    The last thing that I found out was that when the files that were loaded in the session variable came from the database, they would remain after the upload error; but when the files came from the Uploader, they woud be cleared. 

    I guess there's something going on with the streams...

View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems