1 Wenn MVC die Ajax-Post-Übermittlung auf der Ansichtsseite verwendet, weist der Parameter formdata auf eine potenzielle Gefahr hin. Lösung: Fügen Sie [HttpPost] [ValidateInput(false)] zum entsprechenden Methodenheader im Controller hinzu
[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 Der Hauptaktionscode ist [ValidateInput(false)]