A potentially dangerous Request.Form value was detected from the client

前端 未结 30 2226
刺人心
刺人心 2020-11-21 05:24

Every time a user posts something containing < or > in a page in my web application, I get this exception thrown.

I don\'t want to go

30条回答
  •  不思量自难忘°
    2020-11-21 05:56

    In ASP.NET MVC you need to set requestValidationMode="2.0" and validateRequest="false" in web.config, and apply a ValidateInput attribute to your controller action:

    
    
    
        
            
        
    
    

    and

    [Post, ValidateInput(false)]
    public ActionResult Edit(string message) {
        ...
    }
    

提交回复
热议问题