Why does request.rawurl not include http: // localhost part?

When I call Request.RawUrl, I do not get the domain name (at least in development).

For example, if my URL is local:

http: // localhost: 2343 / some / thing

Request Request.RawUrl returns me:

/ some / thing

I remember that it returns everything, is this b / c behavior a local dev?

Update

I also use Url Re-Writing, so things like Request.Url.AbsoluteUri return the internal URL, not the re-written URL that I need to get.

is javascript only then?

Or maybe I can use Request.RawUrl for the url part, and then just somehow get the domain name part? (sometimes it has a port too ...)

+5
6

:

URL- URL-, . URL http://www.contoso.com/articles/recent.aspx URL- -/articles/recent.aspx. URL- , .

Request.Url.AbsoluteUri, .

+6

, Request.Url.

+1

RawUrl URL- .

. RawURL.

+1

MSDN Request.RawUrl:

The raw URL is defined as the part of the URL following the domain information.

Request.Url.

+1

This is design behavior. RawUrlreturns only the portion of the URL following the domain name, as well as any request parameters.

If you need the full url, use Request.Url.

+1
source

To do this for a rewritten URL, you can combine the following:

var result = Request.Url.GetLeftPart(UriPartial.Authority) + Request.RawUrl;
0
source

All Articles