Request.RawUrl vs. Request.Url

后端 未结 5 770
感动是毒
感动是毒 2020-12-13 12:38

What is the difference between Request.RawUrl and Request.Url in ASP.NET?

5条回答
  •  长情又很酷
    2020-12-13 13:07

    From MSDN:

    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.

    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.)

    However, the URL property of an HTTPRequest object returns a System.URI object, which also contains server name.

提交回复
热议问题