Does Request.Url.Host include the subdomain?

▼魔方 西西 提交于 2019-12-08 14:42:22

问题


e.g. for mail.google.com would it return google.com or mail.google.com? I can't actually test it myself


回答1:


It does include subdomain (e.g. mail.google.com)




回答2:


You can save yourself from the headache of waiting for answers by reading documentation on Msdn.

A String that contains the host name. This is usually the DNS host name or IP address of the server.

If the requested DNS record is a subdomain, that's the record it will return. Subdomains are still there own records in a zone file, so its not going to return just the root domain because that's not the same record, nor request.

I was also curious as to why you couldn't test this, but if its because of the lack of an internet connection (maybe you're posting from mobile I don't know) you can add your own records to the Windows HOSTS file and test locally.



来源:https://stackoverflow.com/questions/6593456/does-request-url-host-include-the-subdomain

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!