- 關鍵字:
- maxJsonLength
- 原寫法:
return Json(result, JsonRequestBehavior.AllowGet);
- 解法一:
var serializer = new JavaScriptSerializer();
serializer.MaxJsonLength = Int32.MaxValue;
var result = new ContentResult{
Content = serializer.Serialize(uList),
ContentType = "application/json"
};
return result; - 解法二:
var result =GetJson();
return new JsonResult() {
Data = result ,
MaxJsonLength = int.MaxValue,
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
參考之前文章: