Solved

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

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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 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