本地主机和request.Url.Authority [英] Localhost and request.Url.Authority

查看:121
本文介绍了本地主机和request.Url.Authority的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序通过公司标识符在URL中分离用户:company1.app.com,company2.app.com ...

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

我在我的本地PC上的要求,如测试。然而,我的request.Url.Authority仍显示localhost.com而不是company1.localhost.com。事实上,公司1'的preFIX没有任何地方展示。这是一个错误或功能?

I am testing on my local PC with a request such as: company1.localhost.com. However, my request.Url.Authority still shows "localhost.com" instead of "company1.localhost.com". In fact, the prefix of 'company1' does not show anywhere. Is this a bug or a feature?

值得注意的是我添加到主机文件中的条目为comapany.Blah - > 127.0.0.1。当Request.Url.Authority看着它STIL显示本地主机...

It's worth noting that I added to the host file an entry for "comapany.Blah -> 127.0.0.1". When looking at Request.Url.Authority it STIL shows localhost...

推荐答案

不要使用权威,但使用主机

Do not use the Authority, but use the Host

Request.Url.Host

权威搜索回DNS,主机得到的网址网站。当您搜索DNS你得到你已经使用该名称,而不是所有的名字连接你的IP地址的名字。

The authority search back on dns, the host get the site from the url. When you search the dns you get the first name of your ip address that you have connected with that name and not all names.

这篇关于本地主机和request.Url.Authority的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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