【发布时间】:2011-01-12 21:52:59
【问题描述】:
当我访问 http://localhost:17357/u/a%2fa/m/ssd-10 并查看 Application_BeginRequest 中的 HttpContext.Current.Request.Url 时,我看到了 http://localhost:17357/u/a/a/m/ssd-10 是吗?我不应该得到http://localhost:17357/u/a%2fa/m/ssd-10 吗?我认为转义 url 的重点是?、&、/ 和其他特殊符号不要与它们在 url 中的特殊含义混淆。也许我需要调整配置?
我创建了 4 个用户名,有
a?@!&ee
a?@!/&ee
as d
クイン
链接为
<a href="/u/a%3f%40%21%26ee">a?@!&ee</a><br>
<a href="/u/a%3f%40%21%2f%26ee">a?@!/&ee</a><br>
<a href="/u/as%20d">as d</a><br>
<a href="/u/%ef%bd%b8%ef%bd%b2%ef%be%9d">クイン</a>
最后两个工作,但前两个我得到了异常
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: Illegal characters in path.
然后
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
Additional information: '/u/a?@!&ee' is not a valid virtual path.
我的页面显示Bad Request。我怎样才能允许这些用户名工作。如果不可能,我该如何编写解决方法?
【问题讨论】: