【转】ASP.NET MVC1升级到MVC2以JsonResult作为Action返回值时的错误

错误信息:

System.InvalidOperationException: 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.

 

由错误信息可知MVC2出于对网站数据的保护,默认禁止通过get的请求返回JsonResult数据,你可以在返回Json时,传入第二个参数JsonRequestBehavior.AllowGet。

如:return Json(result, JsonRequestBehavior.AllowGet)。

当然你也可以修改你的前端代码,使用post的方式来获取数据。

posted on 2010-06-01 10:03  Internet 350  阅读(525)  评论(0编辑  收藏  举报

导航