Solved

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

Posted on 2004-10-12
3
246 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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

932 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now