Spell check hander error: The length of the string exceeds the value set on the maxJsonLength property

7 posts, 0 answers
  1. Suhua
    Suhua avatar
    6 posts
    Member since:
    Mar 2013

    Posted 25 Dec 2014 Link to this post

    I use client js method "startSpellCheck(); " to check spelling, it works fine when the text is small, but when the text content is large, for example 30k+ lines, an error page pop up:

     
    Spell Check handler server error: 500<br><br><title>...The length of the string exceeds the value set on the maxJsonLength property.</title><br>...


    I have set the maxJsonLength to a big value in web.config, but it seems that the spell check ignore the setting.
    ...

    <system.web.extensions><br>    <scripting><br>      <webServices>       <br>        <jsonSerialization maxJsonLength="2147483644"></jsonSerialization><br>      </webServices><br>    </scripting><br>  </system.web.extensions>

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 26 Dec 2014 Link to this post

    Hi Suhua,

    Please take a look at the following forum thread and help article, where you will find detailed information on the error that you are receiving and how to handle it:

    Hope this helps.



    Regards,
    Konstantin Dikov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Suhua
    Suhua avatar
    6 posts
    Member since:
    Mar 2013

    Posted 29 Dec 2014 in reply to Konstantin Dikov Link to this post

    Hi Konstantin,

    Thanks for your response,  I have set maxRequestLength and maxAllowedContentLength to a bigger value in the web.config, but still show the same error message:
    Error during serialization or deserialization using the JSON JavascriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

    I also checked the string length which is sent for spelling check: 285478


  5. Suhua
    Suhua avatar
    6 posts
    Member since:
    Mar 2013

    Posted 29 Dec 2014 in reply to Konstantin Dikov Link to this post

    Hi, 

    To reproduce the issue, you can use below codes:

    function spellCheck() {
     
            //get spell check control
     
            var spellCheckID = $telerik.$("[id$='spellCheckRegisterTable']").attr("id");
     
            var spellCheckRegisterTable =
    $find(spellCheckID);
     
            if (spellCheckRegisterTable) {
     
                spellCheckRegisterTable.set_textSource(new checkTextSource());
     
                
    spellCheckRegisterTable.startSpellCheck();           
     
            }
     
        }
     
      
     
        function checkTextSource() {
     
            this.get_text = function () {
     
                
     
                    //for test
     
                    results =
    "";
     
                    for (var i = 0; i
    < 40000; i++) {
     
                        results += "testt<br>";
     
                    }
     
                    
    console.log(results.length);
     
                    //end test
     
                     return results;          
     
     
      
     
            }
     
            this.set_text = function (newText) {          
     
            }
     
        }

     <jsonSerialization maxJsonLength="2147483644"></jsonSerialization>
     <httpRuntime useFullyQualifiedRedirectUrl="false" requestLengthDiskThreshold="8192" maxQueryStringLength="2097151" requestValidationMode="2.0" targetFramework="4.5" maxRequestLength="1048576" executionTimeout="20000" />
    <requestLimits maxAllowedContentLength="1073741824" />

    Could help me on this? I need to fix this as soon as possible. thanks 

    Regards,

    Suhua
  6. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 05 Jan 2015 Link to this post

    Hi Suhua,

    Thank you for the sample.

    I have tested the code snippet that you have provided and I was able to replicate the same issue. It seems that this is a limitation of the JavaScriptSerializer:
    Nevertheless, I have located the code where a new instance of the JavaScriptSerializer is used and I log this as a feature request, so our developers team could investigate the possibility of setting the MaxJsonLength property to int.MaxValue for example or to the value set in the web.config. 

    Please excuse us for any inconvenience caused by this.


    Kind Regards,
    Konstantin Dikov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Duncan
    Duncan avatar
    1 posts
    Member since:
    Dec 2015

    Posted 01 Dec 2015 in reply to Konstantin Dikov Link to this post

    I am having the same issue. Is there anyway to resolve this ? 
  8. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 01 Dec 2015 Link to this post

    Hello Duncan,

    This has not been implemented yet. I created the following page where you can track the progress of this item: http://feedback.telerik.com/Project/108/Feedback/Details/176735-radspell-should-use-the-maxjsonlength-value-specified-in-the-web-config.

    Regards,

    Marin Bratanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017