0

I am sending a base64 string which contains Imagedata to a vb.net webmethod by ajax.

 function savethisimagenow() {
       $('.piccropperdiv').croppie("result", { type: "canvas", format: "jpeg" }).then(function(ImageData){
           //ImageData is a base64 string.               
           var pictureobj = { pictureobj: { picturedata: ImageData } };               
           $.ajax({
               type: "POST",
               url: '/CheemaWebServiceUtilities.asmx/saveprofilepicturefromcrop',
               data: JSON.stringify(pictureobj),
               contentType: "application/json; charset=utf-8",
               dataType: "json",
               success: function (response) {

                   alert('yay');
               },
               failure: function (response) {
                   alert('fail');
               },
               error: function (response) {
                   alert('error');
               }
           });
       });           
   };

It works fine when the string i.e. Imagedata is short (small sized image),

but it shows error when string i.e. Imagedata it is too long.

Anyone out there to help me?

Shakti
  • 723
  • 8
  • 15
  • and this error is? WHERE is the error occuring? on the server receiving the json? in the above code? – Marc B Jul 06 '16 at 21:02
  • When the string is lengthy then web method is not called. It shows up the alert box present in error function. – Shakti Jul 06 '16 at 21:41
  • Message":"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.\r\nParameter name: input","StackTrace":" ......... – Shakti Jul 06 '16 at 21:52
  • 2
    http://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config – Marc B Jul 06 '16 at 21:54
  • Adding following to my web.config sorted out the problem. – Shakti Jul 07 '16 at 11:02

0 Answers0