I\'m hoping to get some clarification on the maxJsonLength property. Here is some background information.
I was having an issue with an AJAX response not being returned
There are two defaults for MaxJsonLength depending on how JavaScriptSerializer is created.
It is 2097152 when serializer is created directly. Relevant code is:
public class JavaScriptSerializer {
...
internal const int DefaultMaxJsonLength = 2097152;
...
public JavaScriptSerializer(...) {
...
MaxJsonLength = DefaultMaxJsonLength;
}
}
It is 102400 when serializer is created by ASP.NET MVC (or older). Relevant code is:
public sealed class ScriptingJsonSerializationSection : ConfigurationSection {
...
private static readonly ConfigurationProperty _propMaxJsonLength =
new ConfigurationProperty("maxJsonLength",
typeof(int),
102400,
...);
...
[ConfigurationProperty("maxJsonLength", DefaultValue = 102400)]
public int MaxJsonLength { ... }
...
}
There are several places which assign serializer.MaxJsonLength to this value — all of them are in ASP.NET-related code.