I had a problem regarding MaxJsonLength
in MVC. The problem occurred when i returned json()
. Then i found a solution here (please read this) answered by fanisch. Now i have many controllers where i have problem of MaxJsonLength
. I want to override this method globally.
protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
{
return new JsonResult()
{
Data = data,
ContentType = contentType,
ContentEncoding = contentEncoding,
JsonRequestBehavior = behavior,
MaxJsonLength = Int32.MaxValue
};
}
How can i do this? Is there any way to impliment this method globally or should i use action filters?