Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8893861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:21:15+00:00 2026-06-14T23:21:15+00:00

Possible Duplicate: Can I set an unlimited length for maxJsonLength in web.config? I have

  • 0

Possible Duplicate:
Can I set an unlimited length for maxJsonLength in web.config?

I have a script in my .aspx page that is sending info to the back-end .cs page. Concept is simple and worst for most occasions, except when data is too large. How can I increase the capacity of what the “data” variable can hold without modifying web.config? Please see code below.

.ASPX

<script type="text/javascript">
    $(document).ready(function () {
        var note = "";
        for (var i = 0; i < 200000; i++)
            note = note + "x";

        $.ajax({
            type: "POST",
            url: "GroupDetailsDisplayPlus.aspx/UpdateRecord",
            data: "{note: \"" + note + "\"}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                var response = msg.d;
                alert("success");
                }
            error: function (request, status, thrownError) {
                //alert(request.thrownError); // short version
                alert(request.responseText);  // long version
            }
        });
    });
</script>

.CS

    [System.Web.Services.WebMethod]
    public static string UpdateRecord(string note)
    {
        return note;
    }

This code is simplified and my purpose is to store this large string in a database (code ommited). If I set the for loop to only do 100,000 cycles this works. However increasing it to 200,000 cycles fails with an error message:

{“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”: at
System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer
serializer, String input, Type type, Int32 depthLimit)\r\n at
System.Web.Script.Serialization.JavaScript
Serializer.Deserialize[T](String input)\r\n at
System.Web.Script.Service.RestHandler.ExecuteWebServiceCall(HttpContext
context, WebServiceMethodData
methodData)”,”ExceptionType”:”System.ArgumentException”}

Thank you for any and all help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:21:16+00:00Added an answer on June 14, 2026 at 11:21 pm

    Try this:

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

    and this:

    <system.web>
      <httpRuntime requestValidationMode="2.0" executionTimeout="600" maxRequestLength="2000000" />
    <system.web>
    

    or divide your data and send part by part:

    var portionIndex = 0;
    var porions = new Array();
    for(i = 0; i < 5; i++)
    {
        var note = '';
        for (var j = 0; j < 40000; j++) note += "x";
        portions.push(note);
    }
    
    SendPortion();
    
    function SendPortion()
    {
            $.ajax({
                type: "POST",
                url: "GroupDetailsDisplayPlus.aspx/UpdateRecord",
                data: {porionsCount: porions.length, portion: porions[portionIndex] },
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                    portionIndex++; 
                    if(portionIndex < porions.length) 
                        SendPortion();
                }
                error: function (request, status, thrownError) {}
            });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: javascript date creation, can't set the correct month I have script like:
Possible Duplicate: Can I set a breakpoint on 'memory access' in GDB? I have
Possible Duplicate: In emacs, can I set up the *Messages* buffer so that it
Possible Duplicate: Can I access session state from an HTTPModule? I have set up
Possible Duplicate: Can I scroll a ScrollView programmatically in Android? I have a chat
Possible Duplicate: Can Read-Only Properties be Implemented in Pure JavaScript? I have an Object
Possible Duplicate: Can anybody suggest the best image resize script in php? I'm still
Possible Duplicate: Can I set a property value with Reflection? How do I set
Possible Duplicate: Can I set a breakpoint on 'memory access' in GDB? I want
Possible Duplicate: How can I set the umask from within java? How do you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.