ashx页面 “检测到有潜在危险的 Request.Form 值”的解决方法(控制单个处理程序不检测html标签)

  如题:html

  使用web.config的configuration/location节点.web

  在configuration节点内新建一个location节点,注意这个节点和system.webserver那些是平级节点server

  而后使用location/@path 来指定某个单独的文件,这个文件能够是aspx也能够是ashx,更加能够是Razor模板的cshtml(固然MVC有Unvalidated方法,用不到这样),htm

  而后在location下面配置page和httpruntime(4.0)节的属性就OK了.这样就能够作到只影响一个文件而不会覆盖其余文件的ValidateReqeust设置。blog

  配置以下:io

  

 <location path="ashx/dosth.ashx" >
    <system.web>
    <httpRuntime  requestValidationMode="2.0" />
    </system.web>
  </location>
相关文章
相关标签/搜索