Dot Net Frame work 4.5 to Frame work 4.7 Issue

thilan

Member
Joined
Oct 8, 2019
Messages
5
Programming Experience
10+
Dear All,

I am having dot net forum 4.5.2 application but my server in on dot net froum4.7 and I am getting data not loading issue to my application. I am getting below message when calling the data from the database.

Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

Thax
 
Hi, and welcome to the forum.

If this is a asp/webforms project, you can add this to your app/web.config file.
C#:
<configuration>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483647"/>
      </webServices>
    </scripting>
  </system.web.extensions>
</configuration>

See docs for more : How to: Configure ASP.NET Services in Microsoft Ajax

If you find that isn't working for you, then you can try :
C#:
            JavaScriptSerializer mySerializer = new JavaScriptSerializer
            {
                MaxJsonLength = Int32.MaxValue
            };
The problem is you are exceeding the max size of integer 2147483647 - The above should resolve it. If not, post back. But remember where ever you define a new serializer, be sure to set its max size as I've done. Hope this helps.
 
Hi, and welcome to the forum.

If this is a asp/webforms project, you can add this to your app/web.config file.
C#:
<configuration>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483647"/>
      </webServices>
    </scripting>
  </system.web.extensions>
</configuration>

See docs for more : How to: Configure ASP.NET Services in Microsoft Ajax

If you find that isn't working for you, then you can try :
C#:
            JavaScriptSerializer mySerializer = new JavaScriptSerializer
            {
                MaxJsonLength = Int32.MaxValue
            };
The problem is you are exceeding the max size of integer 2147483647 - The above should resolve it. If not, post back. But remember where ever you define a new serializer, be sure to set its max size as I've done. Hope this helps.

Thank you Sheepings. C# code part worked for me.
 
Back
Top Bottom