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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/csharp25/article/details/82901555

问题描述: ASP.NET has detected data in the request that is potentially dangerous because it might include HTML markup or script. The data might represent an attempt to compromise the security of your application, such as a cross-site scripting attack. If this type of input is appropriate in your application, you can include code in a web page to explicitly allow it. For more information, see http://go.microsoft.com/fwlink/?LinkID=212874. 

1 在 web.config中加

 <system.web>
...
    <httpRuntime ... requestValidationMode="2.0"/>
...
  </system.web>

2 在 controller的 action上添加属性:

[ValidateInput(false)]


 

猜你喜欢

转载自blog.csdn.net/csharp25/article/details/82901555