I have a site, and it will be sold to different clients but for maintenance reasons, we will be keeping one codebase. So this means that this one codebase will have to be dynamic enough to have different styles and so forth, depending on the client.
The domain would be a subdomain-type system, so: projectname.clientname.com , projectname.clientname.com, and so forth, where client name is the company who we have sold the system to.
What I'm trying to do is to have a different theme load up depending on the domain. So I may have ecards.savills.com, and for that, I have a folder in Themes called Savills, and inside that folder called Savills, a .CSS file and I want to load that. I've been playing with the request object, but no luck.
I've tried several methods to achieve this, using stylesheettheme (don't need to skin buttons btw), but I keep getting stack overflows in a system dll for .NET.
What is a robust way to achieve this?
-
/* Do you have a folder in "Themes" or "APP_Themes" called Savillis? */
When you designate a Theme for a page, all stylesheets in that theme folder will be loaded. They will be loaded alphabetically, so watch the order.
On a page level, you can set the theme in the Page directive (aspx) or the PreInit (codebehind), or you can set a default theme in the web.config. (You can also set a global theme, but thats not usually used.
/* Are you doing that? */
Are there separate web site instances?
From StingyJack -
Use the information in the following think to change the theme in code. Check the HTTP_REFERER to see which domain is being requested and use a SELECT CASE to change to the theme you prefer for that domain.
http://msdn.microsoft.com/en-us/library/tx35bd89.aspx
From Brian Boatright -
Hi,
I have APP_THEMES in my root dir, and then I add a theme to that (which is a folder, which I rename).
I want to set the theme programatically as it's condition bound, so am using page_preinit.
From Blade -
Write an HttpModule to assign domain specific themes. Just like UrlRewrite httpmodule. You can get tutorial on msdn if you don't know how to create httpmodule.
From Pradeep Kumar Mishra -
See this thread -> http://stackoverflow.com/questions/178863/change-theme-css-based-on-user
-
You can use different master pages to accomplish this.
Code a default against one master page (or set of masters) and then change the master page programmatically at runtime based on the host domain.
To do this you must set the page's MasterPageFile property during the OnPreInit phase of the page's lifecycle. (After that it is not allowed because the master has been loaded.)
The master page that is selected can have drastically different layout and reference completely separate CSS files.
From David
0 comments:
Post a Comment