3 r*_*les 2 asp.net-mvc serialization json jsonresult json-deserialization
我将asp.net mvc actionmethod称为JsonResult作为返回类型,并返回至少具有50000 racords的数据列表,并希望设置Ajax返回的大小,并且它也完成了。
但是当我返回值时,会抛出一个错误:
This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet.
Run Code Online (Sandbox Code Playgroud)
我的代码:
return new JsonResult()
{
Data = mydatalist,
MaxJsonLength = Int32.MaxValue
};
Run Code Online (Sandbox Code Playgroud)
在这里我想设置JsonRequestBehavior.AllowGet,但是在哪里以及如何不知道?
在事先感谢之前,任何人都可以这样做。
只需查看JsonResult内部提供的选项,您就会找到JsonRequestBehavior并将其设置为allowget。
return new JsonResult()
{
Data = mydatalist,
MaxJsonLength = Int32.MaxValue,
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2321 次 |
| 最近记录: |