1. 程式人生 > >MVC 從客戶端中檢測到有潛在危險的 Request.Form 值

MVC 從客戶端中檢測到有潛在危險的 Request.Form 值

錯誤:從客戶端(content="<p>asdfaqdf ad</p>")中檢測到有潛在危險的 Request.Form 值。

1.httpRuntime 節點新增requestValidationMode="2.0" 

修改web.config

<system.web>

    ...

    <httpRuntime requestValidationMode="2.0" />

2.Controller中新增[ValidateInput(false)]

[ValidateInput(false)]

public ActionResult Add(string id)

{

}