【发布时间】:2014-02-20 05:05:12
【问题描述】:
我使用 Windows 7、IIS 7.5、.NET 4.5。
(对于 Windows 8、IIS 8.5、.NET 4.5,这有效)。
使用 URL 执行 GET 请求:
http://my.host/api1/MyEntity('%2311282')
问题是当它到达服务器端代码时,%23 字符已经被解码为 '#' 并且 Uri 对象认为它是一个片段字符。 Win8 机器接收到 char %23 untouched 的 url。
尝试:
1)使用此配置设置
<httpRuntime targetFramework="4.5" relaxedUrlToFileSystemMapping="true" />
2) 在网址末尾添加“/”
http://my.host/api1/MyEntity('%2311282')/
3) 卸载 url rewrite 2 模块 - 并重新安装它。还尝试在 web.config 中为模块注释 rewrite 部分。
为什么我想复制 Windows 8 的行为 - 不解码 URL。有什么想法吗?
【问题讨论】:
-
又一次相当糟糕的 dup 标志 imo。问题不一样。另一个答案只说明了为什么它在 IIS 7.5 上编码,而不是如何在 IIS7.5 上防止它,就像问当前问题一样。
标签: asp.net url iis url-routing