I have an ASP.NET web application using MVC 4, jquery, and Telerik's Kendo controls.
I have the following on my webpage:
<input id="cmdSaveToFile" title="Save To File" class="button" type="button" value="Save To File" onclick="SaveToFile();" tabindex="2" />
However, if I set a breakpoint in my Javascript file where SaveToFile()
is defined, the breakpoint does not get hit. This method is supposed to send an ajax request to the server which will then create a file and store it in a session variable for downloading later.
Error logs on the server cite this error:
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
I've looked at these SO questions for that specific error:
MaxJsonLength exception in ASP.NET MVC during JavaScriptSerializer
Can I set an unlimited length for maxJsonLength in web.config?
I've added the accepted answer's contents to my web.config but that did not fix the problem. I cannot programatically set the JsonResult.MaxJsonLength
property because I have no idea what is happening between clicking on the button and the method I specified in the view file from actually executing. Using Visual Studio + IE I can't break anywhere; not in the controller and not in the JS.
If I use Chrome, in their dev tools' "Event Listener Breakpoints" I can get it to break on Mouse Up / Down / Click but all of the jquery that executes is completely unreadable to me. What could it be doing under the hood that would cause this error?
Edit To clarify, the webpage in question simply contains a textbox and 2 buttons: Save to File, and Close. If you click Save to File, the software writes the contents of the textbox to an RTF file and presents the file to the user for download. This textbox contains an error report after they've uploaded a file and attempted to parse it out. If I upload and parse a small file, it behaves correctly. It's only when I upload very large files which creates a large amount of errors that this no longer works (because the error report is too long for JSON)... But if my breakpoint in SaveToFile()
doesn't get triggered then what the hell is it doing?