ASP.NET中Request.RawUrl、Request.Url的区别


如果访问的地址是:

http://hovertree.com/guestbook/addmessage.aspx?key=hovertree%3C&n=myslider#zonemenu

那么

Request.Url.ToString() 的值是:
http://hovertree.com/guestbook/addmessage.aspx?key=hovertree<&n=myslider 

Request.RawUrl.ToString() 的值是:
/guestbook/addmessage.aspx?key=hovertree%3C&n=myslider

我们可以看出

Request.RawUrl 不包含主机名及前面的内容。

Request.RawUrl 完整地体现地址栏的 QueryString,

而 Request.Url 会进行 Server.URLDecode 解析。

而且两个的相同地方是,都不包含#以及后面的字符串

 查看留言:http://hovertree.com/guestbook/

转自:http://keleyi.com/a/bjae/avh3bdvq.htm

技术文章:http://www.cnblogs.com/sosoft/p/kaifajishu.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM