我使用ASP.NET WebAPI构建了一个非常简单的控制器,没有进行任何自定义。代码如下
public class TestController : ApiController
{
[Route("encoding/{x}")]
[HttpGet]
public string GetEncoding(string x)
{
return x;
}
}
现在从客户端开始,我需要传递一个URL为http://localhost:19477/encoding/�
的Unicode字符―编码为http://localhost:19477/encoding/%EF%BF%BD
。但是,在调试过程中,我发现AbsoluteUri
对象中的Request
更改为"http://localhost:19477/encoding/%C3%AF%C2%BF%C2%BD"
,这改变了我的原始路径。
这会使收到的字符串与原始请求完全错误。