.NET Tips: 正确获取当前URL

[ 2005-11-17 09:13:49 | 作者: admin ]
字号: | |
.NET Tips: 正确获取当前URL
获取当前URL我一直使用HttpContext.Current.Request.Url.ToString(),今天Tinyfool指出我的一个Bug,调试发现,ToString()函数并不可靠。

如果当前URL为
http://localhost/search.aspx?user=tinyfool&tag=%BC%BC%CA%F5
通过HttpContext.Current.Request.Url.ToString()获取到的却是
http://localhost/search.aspx?user=tinyfool&tag=¼¼Êõ
这显然不对,怎么办?用HttpContext.Current.Request.Url.PathAndQuery好了,这个得到的正确的。:)
评论Feed 评论Feed: http://blog.xg98.com/feed.asp?q=comment&id=199

这篇日志没有评论。

此日志不可发表评论。