从客户端(FormData) 中检测到有潜在危险的 Reques...

1 mvc在view页面使用ajax的post提交时,参数formdata,提示有潜在危险,解决方案:在controller中对应的方法头上添加[HttpPost] [ValidateInput(false)]

 [HttpPost]
        [ValidateInput(false)]
        public ActionResult Add(QX_ProductModel model)
        {
            ....
            ....

            AjaxResult result = new AjaxResult();
            if (count > 0)
            {
                result = SuccessTip("添加成功");
            }
            else
            {
                result = ErrorTip("添加失败");
            }
            return Json(result);
        }

2 主要作用代码是 [ValidateInput(false)]

猜你喜欢

转载自blog.csdn.net/zhang123csdn/article/details/126539647