I want to create an asp.net white-label site http://whitelabel.com, that could be styled for each of our clients according to their specific needs. So for example, client abc would see the site in their corporate colours and be accessed through their specific url http://abc.com. Likewise client xyz would see the site in their own styling and url http://xyz.com.
Typing either url, in effect, takes the user to http://whitelabel.com where the styling is applied, and the client’s url structure is retained.
I was thinking of URL rewriting using URLRewriter.Net (http://urlrewriter.net/), or similar, mapping the incoming address to a client id and applying the theme accordingly. So, a url rewrite rule may be something like
<rewrite url="http//abc.com/(.+)" to="~/$1?id=1" />
<rewrite url="http//xyz.com/(.+)" to="~/$1?id=2" />
I could then read the id, map it to the client, and with a bit of jiggery-pokery, apply the correct theme.
I was wondering if:
- this is the right approach ?
- I’ve overlooked something ?
- there is a better way to do this ?
Any suggestions would be appreciated.
You can have multiple domains all running off the same iis site, each with a different themes. You don’t even need to rewrite the url.
We point different domains all to the same site using host headers, then we check the host name …
… in the OnPreInit event in our base page class. Based on the host name we set the page theme, which has all the css and custom images set in the App_Themes
Link to information on setting themes programmatically:
http://msdn.microsoft.com/en-us/library/tx35bd89.aspx?PHPSESSID=8415f84585668e69ce791db4abfd0c45