Using two hostnames for the same .NET application

I need to have 2 domain names that will basically be the same application, but with a different theme or skin. I know I can check the domain name using Server Variables, but how do I specify both domains in the same application? And I'm developing it like a normal site (except for the theme?) Am I just doing another "Website Project"? Also, I now have access to my local dev machine ( http: // localhost ) and not the domains, so how do I get tested and set up this? Thanks!

0


a source to share


1 answer


You would do it in IIS. Your DNS will point both domains to the same computer, and then inside the IIS headers, you put both domain records.

As far as handling it from a code perspective, you can use the Request object (HttpRequest.Url) to determine which of the two sites is being visited and dynamically change any settings on the site.

Edit. Oh, missed a bit about testing. Well, your best bet is to put two records in your HOSTS file with your domain name. Edit file c: \ windows \ system32 \ drivers \ etc \ hosts and add the following line



fakedomain1.com 127.0.0.1

fakedomain2.com 127.0.0.1

EDIT2: Editable ninja changes are annoying.

+3


a source







All Articles