Local address and request.Url.Authority

My application separates users by company identifiers at the URL: company1.app.com, company2.app.com ...

I am testing my local computer with a request, for example: company1.localhost.com. However, my request.Url.Authority still shows "localhost.com" instead of "company1.localhost.com". In fact, the prefix 'company1' is not displayed anywhere. Is this a bug or function?

It is worth noting that I added an entry to the host file for "comapany.Blah → 127.0.0.1". When looking at Request.Url.Authority, this STIL shows localhost ...

+6
c # request
source share
2 answers

Do not use authority, but use Host

Request.Url.Host 

The authorization request is returned to dns, the host receives the site from the URL. When you search in dns, you get the first name of your IP address associated with that name, not all the names.

+1
source share

Use headers on localhost:

 Request.Headers.Get("Host") 
0
source share

All Articles