zoukankan      html  css  js  c++  java
  • [BILL WEI] A potentially dangerous Request.Path value was detected from the client 异常处理办法

    我们在ASP.net中使用URL导向后, 我们在访问某个地址,或者打开某个系统页面的时候,就会报错误: 

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

    at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()  

    at System.Web.HttpApplication.ValidateRequestExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  

    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    这是因为上述地址中有*这个特殊字符存在。

    如果你想不让ASP.net 替你拦截这些特殊字符,你需要设置如下Web.config的节:

    <?xml version="1.0"?>
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <system.web>
    <httpRuntime requestPathInvalidCharacters="" />
    </system.web>
    </configuration>

    注意其中的requestPathInvalidCharacters 它是一个以逗号分隔的无效字符列表。不设置它时,它默认的无效字符集(以,分割)是后面7个:<,>,*,%,&,:,/

    即,不设置这个属性,默认就是如下设置:

    <?xml version="1.0"?>
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <system.web>
    <httpRuntime requestPathInvalidCharacters="&lt;,&gt;,*,%,:,&amp;,/" />
    </system.web>
    </configuration>

    如果你想这些字符全部不受限制,就应该设置 requestPathInvalidCharacters="" , 如果是部分字符受限制,部分字符不受限制,就需要在 requestPathInvalidCharacters 中设置需要受限制的字符,不受限制的不用设置。

    转载:http://blog.csdn.net/ghj1976/archive/2010/06/29/5701277.aspx

  • 相关阅读:
    NameError:name ‘xrange’ is not defined
    CNN卷积核反传分析
    在定义卷积时为什么要对其中一个函数进行翻转
    Python的浮点数损失精度问题
    Python实现im2col和col2im函数
    2018.04.19
    4 Git 基础
    Clash Royale开发日志
    2018-04-12
    python urllib2
  • 原文地址:https://www.cnblogs.com/teamate/p/3732585.html
Copyright © 2011-2022 走看看