无法传入“%26”到 WCF 服务中的 WebGet UriTemplate 变量?
我有一个具有此声明操作的 WCF 服务:
[WebGet(UriTemplate = "Test/{*testString}")]
public String Test(String testString)
{
return testString;
}
但是,当尝试调用 URL Test/You%26Me
时,IIS 返回错误:
A potentially dangerous Request.Path value was detected from the client (&).
我的目标是通过其 URL 编码在 URI 中允许使用 & 符号: %26
通配符没有帮助。有没有什么方法可以在不禁用安全功能的情况下防止此错误?
I have a WCF service with this declared operation:
[WebGet(UriTemplate = "Test/{*testString}")]
public String Test(String testString)
{
return testString;
}
However when attempting to invoke the URL Test/You%26Me
, IIS returns an error:
A potentially dangerous Request.Path value was detected from the client (&).
My goal is to allow an ampersand in the URI via its URL-Encoding: %26
The wildcard did not help. Is there any way to prevent this error without disabling security features?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
RequestPathInvalidCharacters
Web.config 中的 配置属性避免使用字符,如下所示:Try using
RequestPathInvalidCharacters
configuration property in Web.config avoiding used characters as follows: