Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an asp.net 3.5 app running on NT Server 2008, IIS 7.0.

I want to point multiple domains to this single website (easy enough to do), but also want the app to know which domain the user came in on, and always keep that domain in the address bar so each of my clients gets a "branded" /customized view of the web application, even though underneath its all the same code running.

What is the general way to do this?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You do not really need to do anything. If the site is answering to multiple domains, then the user will see the same domain name in the address bar as he/she goes from page to page through the site.

If you have specific text that needs to be changed for each different domain, you can always grab the value of the current domain using:

HttpContext.Current.Request.Url.Host

and then use that value as needed in your website code.

To see an example of a multi-domain website, take a look at mine. You will see how I change the email address in the page header based on the domain that the user is coming from.

Try http://www.fileupdown.com first. Then, try http://www.noonmarktech.com

Hope this helps.

share|improve this answer
    
keep in mind that this assumes that you don't use the domain name in any URLs throughout the site. –  Swoogan Sep 3 '09 at 14:42

Fred's answer and examples are correct. However you can also have totally different experiences with some case logic on server side pages. You can swap out navigation based on domain, style sheets, and set server variables to control every aspect of your site. Content will need to be kept separate but that would be handled via site nav.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.