Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Request.Url.Host include the subdomain?

Tags:

c#

url

request

host

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

like image 924
Adam Lynch Avatar asked Jul 06 '11 08:07

Adam Lynch


People also ask

Does host include subdomain?

Any hostname is a subdomain except if it is a TLD. www can be a hostname if it is assigned to a specific host withing a network or can be a subdomain where lower level hosts are located, like server1.www.example.net.

What part of a URL is the subdomain?

To recap, a subdomain is the portion of a URL that comes before the “main” domain name and the domain extension. For example, docs.themeisle.com . Subdomains can help you divide your website into logical parts or create separate sites, for example a separate blog for each sports team.

Does domain include subdomain?

A subdomain is an add-on to your primary domain name. Essentially, a subdomain is a separate part of your website that operates under the same primary domain name. To create a subdomain, you must have a primary domain name. Without a primary domain name, there's no way to add a subdomain onto it.

Do subdomains need their own hosting?

Because subdomains are regarded as separate websites by Google, they also need to be hosted on separate hosting plans. This means that you will need to pay a separate hosting fee for each subdomain.


2 Answers

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

like image 97
Marek Musielak Avatar answered Sep 30 '22 21:09

Marek Musielak


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.

like image 28
David Anderson Avatar answered Sep 30 '22 22:09

David Anderson