Request.RawUrl与Request.Url [英] Request.RawUrl vs. Request.Url

查看:130
本文介绍了Request.RawUrl与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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆