Request.RawUrl与Request.Url [英] Request.RawUrl vs. Request.Url
问题描述
是什么在ASP.NET Request.RawUrl
和 Request.Url
之间的区别?
What is the difference between Request.RawUrl
and Request.Url
in ASP.NET?
推荐答案
从MSDN:
的原始URL被定义为部分
下列域的网址
信息。在URL字符串
http://www.contoso.com/articles/recent.aspx
,
原始网址是
的 /articles/recent.aspx
的
The raw URL is defined as the part of the URL following the domain information. In the URL string
http://www.contoso.com/articles/recent.aspx
, the raw URL is/articles/recent.aspx
.
这意味着,你可以使用 rawurl
并没有在意,通过它解决服务器被称为(例如的http:// yourserver /
或 http://yourserver.yourdomain.com/
如果您有多个接口。)
This means, you can use rawurl
and do not have to care about through which address the server was called (for instance http://yourserver/
or http://yourserver.yourdomain.com/
if you have multiple interfaces.)
然而, HTT prequest
对象的网址
属性返回的System.Uri
对象,其中还包含服务器名称。
However, the URL
property of an HTTPRequest
object returns a System.URI
object, which also contains server name.
这篇关于Request.RawUrl与Request.Url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!