从客户端检测到有潜在危险的Request.Form值:

在webForm中,可以在aspx页面顶部

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MaddAptitude.aspx.cs" Inherits="MaddAptitude" %>

中加一句  ValidateRequest="false"  。

或者在web.config文档<system.web>后面加入这一句: <pages validaterequest="false"/> ,例如:

<configuration> 
    <system.web> 
        <pages validaterequest="false"/> 
    </system.web> 
</configuration>

在MVC中,可以在controller里面加 [ValidateInput(false)] ,例如:

   [ValidateInput(false)]  
    public class AdminController : Controller
    {
        ........
        return View();
    }

如果还是不行的话,在web.config中加<httpRuntime requestValidationMode="2.0"/>,即:

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

 

相关文章:

  • 2022-12-23
  • 2022-02-09
  • 2021-06-25
  • 2022-12-23
  • 2022-01-23
  • 2021-09-22
  • 2021-07-10
猜你喜欢
  • 2022-12-23
  • 2021-06-18
  • 2022-12-23
  • 2021-09-22
相关资源
相似解决方案