Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to get host name (http://test.mysite.com)

Posted on 2004-10-12
3
Medium Priority
?
287 Views
Last Modified: 2008-01-09
using asp.net, how can I get this part when people go to a web page:
http://test.mysite.com

doesn't matter if we go to
http://test.mysite.com/folder1/test.aspx
or
http://test.mysite.com/folder1/test2/test222.aspx

I just want to get the http://test.mysite.com part...
multiple sites will point to the same page, like
http://test.mysite.com 
http://test2.mysite.com 
http://test3.mysite.com 

Thanks!
0
Comment
Question by:davexxxx
3 Comments
 
LVL 18

Accepted Solution

by:
tusharashah earned 400 total points
ID: 12293645
You'll get what you want from following method:

Request.Url.Host

-tushar
0
 
LVL 3

Expert Comment

by:gspronych
ID: 12295146
What you want to do is set your host headers

You can have 2 domains names at the same IP, and you configure which site answers which host header
ie.
mysite.com
mysite2.com

This guide explains how to set host headers in IIS 5
http://support.microsoft.com/default.aspx?scid=kb;en-us;308163

This guide explains how to set host headers in IIS 6
http://support.microsoft.com/?id=324287

It is important to understand host headers before setting subdomains.

The next step to setup sub domains is very similiar
So if you want names like
news.mysite.com
account.mysite2.com

You follow the same steps in the above guides, but instead of putting the full domain name, put in a sub domain
set the host header value to test.mysite.com

Now, your subdomain will be setup locally, but it needs to be configured for the internet.
So if you ISP hosts you DNS records (in most cases they will) you need to contact them and ask them to setup the sub domain.
Sometimes they charge for this service.
If you are not sure, contact your ISP; they will know.

If you host your own records you may have to post a question in the networking section of this BB.
I'm just a lowly developer. ;P

Cheers
0
 

Author Comment

by:davexxxx
ID: 12303300
I'm good with all the details, just looking for
Request.Url.Host

Thanks, though!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question