Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-10-12
3
Medium Priority
?
283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 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