ClientSize MaxSizeKB Validation

Last post 11-02-2012, 3:27 PM by harikesani. 2 replies.
Sort Posts: Previous Next
  •  11-01-2012, 1:16 PM 75135

    ClientSize MaxSizeKB Validation

    We have used AjaxUploader in our ASP.NET application and set MaxSizeKB as 2048 for 2 MB files. During security testing by third party company, they were able to remove client side validation in proxy (Fiddler) and upload 1 GB file. Even though we have set maxRequestLength and maxAllowedContentLength as 5MB in config file, AjaxUploader is sending file to the server as multiple partial requests and size of these requests are less than maxAllowedContentLength.

     

    Is there a way, we can disable sending file as partial requests or set size of each partial request? 

     

     

  •  11-02-2012, 7:51 AM 75136 in reply to 75135

    Re: ClientSize MaxSizeKB Validation

    Hi harikesani,

     

    1. If you want to valid the upload file size at client side, please try aip " CuteWebUI_AjaxUploader_OnSelect".

     

    1. <script>  
    2.     function CuteWebUI_AjaxUploader_OnSelect(files) {  
    3.   
    4.         for (var i = 0; i < files.length; i++) {  
    5.             if (files[i].FileSize > 2000000)  
    6.                 alert("file to large!");  
    7.             files[i].Cancel();  
    8.   
    9.         }  
    10.     }  
    11. </script>  
     

    2.  The multiple partial requests function is the silverlight plug-in function, if you do not need it, please disable the silverlight upload mode, like below. uploader1 is the upload control id.

     

    1. protected override void OnLoad(EventArgs e)  
    2.  {  
    3.      uploader1.SetAdvancedOption(UploaderAdvancedOption.NoSilverlight, "true");  
    4.      base.OnLoad(e);  
    5.  }  
     

    Regards,

     

    Ken 

  •  11-02-2012, 3:27 PM 75143 in reply to 75136

    Re: ClientSize MaxSizeKB Validation

    Solution perfectly worked - Thanks Ken.

View as RSS news feed in XML