Solved

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

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 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

19 Experts available now in Live!

Get 1:1 Help Now