0
我想在我的C#项目中使用JavaScript上传器。 JavaScript的被装载在母版页,并在局部视图我想要上传到是我有以下代码:允许Json获取而不使用Return(data,JsonRequestBehavior.AllowGet)(要允许GET请求,请将JsonRequestBehavior设置为AllowGet。error)
<a class="upload" href="/Administration/blue/en-gb/Entity/StoreFile/97?Entity=Note&Field=File">uploadfile</a>
然而,当我按一下按钮,我得到一个““这一要求已因为在GET请求中使用这些信息时,敏感信息可能会泄露给第三方网站。要允许GET请求,请将JsonRequestBehavior设置为AllowGet。错误。同样的问题可以发现here。然而,作为解决像下面这样给出:
return Json(new { mymsg = "my msg" }, JsonRequestBehavior.AllowGet);
凡加入JsonRequerstBehavior.AllowGet解决了这个问题。
在调用中,我要添加这个PartialView我的C#的ActionResult我有这样的回报:
我也试过:
<%$.post('/blag/JSON', function (data) {%>
<a class="upload" href="/Administration/blue/en-gb/Entity/StoreFile/97?Entity=Note&Field=File">uploadfile
</a>
<%});%>
,但没有奏效。
我无法添加JsonRequestBehavior.AllowGet。如何在没有这个的情况下做到这一点.AllowGet?
您是否必须返回部分视图或json? – 2012-02-13 18:11:19