得到“从客户端(和)中检测到潜在的危险Request.Path值"

编程入门 行业动态 更新时间:2024-10-26 10:26:35
本文介绍了得到“从客户端(和)中检测到潜在的危险Request.Path值"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个REST服务,当我尝试呼叫名称为& 的项目时,出现上述错误,如果我没有编码,这将是有道理的&

I have a REST Service and when I try and make a call to an item that has a & in it's name, I get the above error, which would make sense if I was not encoded the &

这将是我的电话:

localhost:57851/myService/Servers/myServer/Repositories/myRepository/Models/Mine%26Yours

您会看到"Mine& Yours"已被编码为"Mine%26Yours",因此应该是安全的.

You can see "Mine&Yours" has been encoded as "Mine%26Yours" so should be safe.

但是我好像没有对请求进行编码.

But the request is being picked up as though I'd not encoded it.

有什么想法吗?

这不同于(从客户端(&)获得潜在危险的Request.Path值" )

推荐答案

无论是否编码&符号,对ASP.NET都没有影响.查看此答案: stackoverflow/a/12037000/134761

It makes no difference to ASP.NET whether you encode the & symbol or not. See this answer: stackoverflow/a/12037000/134761

要在URL路径中允许使用特殊字符,您应该像这样修改web.config中的requestPathInvalidCharacters参数:

To allow special characters in your URL path you should modify the requestPathInvalidCharacters parameter in web.config like this:

<httpRuntime requestPathInvalidCharacters="" />

或者,如果您只想允许&但不允许所有其他特殊字符,则:

Or if you want to only allow & but disallow all other special chars:

<httpRuntime requestPathInvalidCharacters="&lt;,&gt;,*,%,\"/>

更多推荐

得到“从客户端(和)中检测到潜在的危险Request.Path值"

本文发布于:2023-11-12 05:11:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580600.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:检测到   客户端   危险   quot   Path

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!