Long time of execution of FileUploaded event leads to exception

Last post 12-07-2012, 7:36 AM by AlxReiter. 2 replies.
Sort Posts: Previous Next
  •  12-03-2012, 8:45 AM 75387

    Long time of execution of FileUploaded event leads to exception

    Hi

    I have a big and slow code for event FileUploaded.

    During execution of this code, i've got an exception message:

    Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

    In js code function

    function Sys$WebForms$PageRequestManager$_endPostBack

     

    Also, if i try debug the event FileUploaded very slowly, i've got this message too.

     

    1. protected void fileinput_FileUploaded(object sender, UploaderEventArgs args) 
    2.         { 
    3.             Uploader uploader = (Uploader)sender; 
    4.             Uploader uploaderControl = null
    5.  
    6.  
    7.             foreach (Control c in this.UpdatePanel1.ContentTemplateContainer.Controls) 
    8.             { 
    9.                 if (c is Uploader) 
    10.                 { 
    11.                     if (c.Visible) 
    12.                     { 
    13.                         uploaderControl = (Uploader)c; 
    14.  
    15.  
    16.                         if (uploaderControl.ID == uploader.ID) 
    17.                         { 
    18.                             string path = "C:\\UploaderTempNew\\"
    19.                             args.MoveTo(path + args.FileName); 
    20.                         } 
    21.                     } 
    22.                 } 
    23.             } 
    24.       } 
     

    After i've got an exception, the uploader stops working and page not refreshed.

    As result - the .resx files not deleted after uploading.
     
    How i can execute big and slowly code  without this exception?

  •  12-03-2012, 2:45 PM 75392 in reply to 75387

    Re: Long time of execution of FileUploaded event leads to exception

    Hi ,

     

    If change the code to below, does it get the same error?

    1. protected void fileinput_FileUploaded(object sender, UploaderEventArgs args)
    2.         {
    3.  
    4.                          string path = "C:\\UploaderTempNew\\";
    5.                             args.MoveTo(path + args.FileName);
    6.  
    7.       }

     

    If move it out of the updatepanel, does it work?

     

    Regards,

     

    Ken

  •  12-07-2012, 7:36 AM 75413 in reply to 75392

    Re: Long time of execution of FileUploaded event leads to exception

    Sorry,it were updatepanel error.
View as RSS news feed in XML