Creating prefix.mysite.com

Hi:

I have a .Net Web Site - actually Learning Management System that I would like users to enter via a prefix - e.g.  apples.mysite.com, oranges.mysite.com.  Depending on how they come in, I would like to change the skin or theme of the website - something that I can readily do.  

What I am looking for is articles/best practices/suggestions on how to create the prefix.mysite.com in .Net 4.0 and as part of my web site.

Any help greatly appreciated.
RBSAsked:
Who is Participating?
 
MlandaTCommented:
The issue is in fact more about DNS than IIS. Do you have access to manipulating your DNS records for the site? To setup what you want, you would need to setup a wildcard DNS entry pointing to your website ip address.
*.example.com IN A 1.2.3.4

Open in new window

How you accomplish the DNS configuration will depend on who handles your DNS. If your DNS provider does not provide wildcard DNS entries you’ll want to find one who does.

Once you've done this, you can then use IIS Url Rewriting Rules to "rewrite" requests for abc.example.com to example.com/abc. So creating a subdomain becomes similar to simply creating a subfolder in your website and putting any necessary files into that subfolder. Alternatively, you could even rewrite that url out as "example.com/index.aspx?siteid=abc". Or even further virtualising that whole infrastructure as necessary. Just anything that suits your application model.

These articles may help:
http://www.seoconsultants.com/windows/isapi/subdomains/
http://thethoughtfulcoder.com/blog/8/IIS-7-URL-Rewrite-subdomains-and-host-headers
http://msmvps.com/blogs/bernard/archive/2005/03/22/39218.aspx
0
 
Bob LearnedCommented:
One approach is to use themes, and CSS style pages, and set the Page.Theme in the Page_PreInit.

How to: Apply ASP.NET Themes Programmatically
http://msdn.microsoft.com/en-us/library/tx35bd89.aspx

If you have master pages, then you can centralize this approach.
0
 
qwe123kiddsCommented:
Hi

You may have to try url rewriting.. in Asp.net there loads of same of that on net//
0
 
RBSAuthor Commented:
thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.