首页 > 其他分享 >A potentially dangerous Request.Path value was detected from the client 异常

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

时间:2023-06-21 22:05:30浏览次数:40  
标签:Web ASP dangerous requestPathInvalidCharacters Request System value HttpApplicat

我们在ASP.net 4.0 中使用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

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

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

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

 

参考资料:

Experiments in Wackiness: Allowing percents, angle-brackets, and other naughty things in the ASP.NET/IIS Request URL
http://www.budoou.com/article/981320/

标签:Web,ASP,dangerous,requestPathInvalidCharacters,Request,System,value,HttpApplicat
From: https://blog.51cto.com/u_15588078/6532078

相关文章

  • net 中的 new RestRequest()代码举开发过程中实用的例子
    //创建一个RestClient对象varclient=newRestClient("http://api.openweathermap.org");//创建一个RestRequest对象varrequest=newRestRequest("/data/2.5/weather",Method.GET);//添加请求参数request.AddParameter("q","London");......
  • requests爬虫实践之安居客二手房屋数据(python实现)
    1.先从安居客官网上淘到如下数据(详细方法可见博主爬取爱彼迎那篇博客):2.源码(警告:若频繁爬取安居客官网数据,将被要求入网验证…)importrequestsfrombs4importBeautifulSoupheaders={'user-agent':'Mozilla/5.0(WindowsNT10.0;WOW64)AppleWebKit/537.36(KHTML,l......
  • The remote SSH server rejected X11 forwarding request.“远程SSH服务器拒绝X11转发
       启动kkFileView后弹出提醒无法正常访问服务器, 重启服务器时,需要安装出现如下提醒方法一、 X11forwarding依赖xorg-x11-xauth软件包,需要先安装xorg-x11-xauth软件包。1.使用Xshell执行下面代码[root@VM-4-11-centos~]#yuminstallxorg-x11-xauth  ......
  • QA|ValueError: write to closed file报错怎么debug|IHRM接口自动化测试
    unittest生成自动化测试报告时报错ValueError:writetoclosedfile,如下图代码如下:  原因排查:因为withopen打开文件后会自动关闭,也就是上图16行执行完就自动关闭了,此时再执行测试套件就无法写入已关闭的文件中了,解决办法是把测试套件执行操作放到withopen里面,如下图: ......
  • 基于Easy-Poi 的自定义 ArgumentResolver 和 ReturnValueHandler
    开发中常用到Excel的导入导出,为了方便快速的使用,让使用者使用Excel像使用JSON一样便捷(@RequestBody@ResponsBody)所以,是否可以自定义编写类似功能的注解 @RequestExcel 和@ResponseExcel  一、实现思路:根据Mvc的参数转换和返回值处理机制实现,excel相关工具......
  • 一次SQL_ID和HASH_VALUE转换尝试引发的误区
    这篇文章中曾谈到一个隐藏问题:引用原文:“使用@dbsnake大牛的SQL可以知道SQL_ID和HASH_VALUE的一一对应关系:隐藏问题1:这里的截图可能有点问题,结果并不准确,问题就出在这个SQL中使用的算法中,在另一篇博文中会仔细说明这个问题。”问题背景:这里使用以下两个SQL获取SQL_ID对应的HASH_VAL......
  • 关于ASP.NET.CORE中的Failed to read parameter "string param" from the request bod
    先上报错信息Microsoft.AspNetCore.Http.BadHttpRequestException:Failedtoreadparameter"stringparam"fromtherequestbodyasJSON.--->System.Text.Json.JsonException:'s'isaninvalidstartofavalue.Path:$|LineNumber:0|By......
  • mysql:报错Incorrect string value:’\xF0\x9F\x94\xA6\xF0\x9F…’
     一,报错信息:1,报错:Incorrectstringvalue:'\xF0\x9F\x94\xA6\xF0\x9F...'forcolumn'content'atrow1报错的原因:字符串中包含了emoji表情:如:......
  • request超出了配置的maxQueryStringLength
    整个URL的长度为966个字符,经过研究,似乎maxQueryStringLength的默认值是2048<security><requestFiltering><requestLimitsmaxQueryString="2048"></requestLimits></requestFiltering></security>在项目的根web.config中的system.web节点下:&......
  • 3. @RequestMapping注解
    1.@RequestMapping注解的功能‍@RequestMapping注解的作用就是将请求和处理请求的控制器方法关联起来,建立映射关系。‍SpringMVC接收到指定的请求,就会来找到在映射关系中对应的控制器方法来处理这个请求‍2.@RequestMapping注解的位置‍@RequestMapping标识一个......