views:

58

answers:

2

Summary

I have a web-application with more than 5 themes. Each themes covers a completely different style for different customers. whenever we publish a new version of our application we send it for all of customers.

The problem.

We specify theme in web.config file in <Page> tag. like

<page theme="Theme1" /> // or Theme2 for second customer.

with this approach we easily change the style of application from each other without writing codes which needs a new publish for each one.

With changing the theme="Theme1". nothing change and we didn't write a code in application , so why changing theme don't change the theme and we need a new publish?

we want to change it in web.config or somewhere else and with changing it the theme change without needing a new publish for each one.


Update :

I Publish Once and then copy the published version for each customer (5 times) then in each web.config file I change the theme="CustomerTheme". but only the theme which was active in publish process is usable in all of 5 versions and other 4 themes are un-usable

--

Actually the main question is that why changes in Web.Config need a different publish while it is XML and do not need a complie. I should Add this note that, App_Theme include all of 5 themes so that all of them Compiles and are ready to use

--

This is the way I publish the application

Publish

Photo Link


Update 2

here IFound the exact problem reported by someone else. he resolve the problem but I can't underestand how he resolved this Issue. can anybody tell me how he resolved the issue?

he used aspnet_compiler command and told that automatically ADDS the 'theme' on the Page directive

(first post is the question and the last post is the answer)

http://bytes.com/topic/asp-net/answers/495850-themes-web-config

+1  A: 

Did you publish the app as precompiled? If so this could be the cause.

Why not store the theme to use in a database table and access it there rather than the web.config? This should then be truly 'on the fly'.

JamWheel
I exactlypublish as pre-compiled, so why it's the reason ? what's the solution then ?
Nasser Hadjloo
I'd update the question with a photo (and a link to photo) of the wayI Publish the application, take a look please
Nasser Hadjloo
I think you can't make changes to the site on the fly without republishing when you publish as precompiled. I would store theme based info in a database somewhere as a more updatable and easier to support solution going forward
JamWheel
I found a solution here `http://bytes.com/topic/asp-net/answers/495850-themes-web-config` canyou please explain how he resolved this issue. I didn't work with `aspnet_compiler command`
Nasser Hadjloo
He doesn't appear to have found a solution, just what the problem is - the compiler was adding the theme to the page directive, i suspect whether or not you use the compiler command is irrelevant, if it is precompiled it isn't updatable on the fly...
JamWheel
+1  A: 

If I understood you correctly, you have one theme for each customer and that will not change?

Still, I do not understand your publishing scenario? Why do you want to change the Theme if each customer has its own web application?

Nevertheless, how about you check the request url in the codebehind and set the Theme Name programatically?

Pseudo-code: (you need to have this piece of code executed on every request. You could write an HTTPHandler for this, or use the BeginRequest Event in the global.asax. You also need to find which property provides the necessary URL information)

switch(Request.URL)
{
 case "www.customer1.com":
    Theme = "Customer1";
    break;
 case "www.customer2.com":
    Theme = "Customer2":
    break;
}
citronas
You underestood me 100% right. I have tochange the Theme in `Web.Config` for each customer and it will happen only once in web.config, but only the theme which I Publish with it will work and I can't change the theme for each customer, then Ihave to publish whole application for each of them. And I don't want to use code if it can have any on-the-fly solution
Nasser Hadjloo
I don't get you. What do you mean by "then Ihave to publish whole application for each of them". If you make changes to your codebase, and each customer has its own web application (in terms of IIS applications) then you definetly need to publish it for all customers, to make the changes. I think you need to explain this Theme thing a bit more
citronas
I Publish Once and then copy the published version for each customer (5 times) then in each `web.config` file I change the `theme="CustomerTheme"`. but only the theme which was active in publish process is usable in all of 5 versions and other 4 themes are un-usable
Nasser Hadjloo
I'd update the question witha photo of the way I publish the application
Nasser Hadjloo
Why are the others unusable? Each theme you implemented should be fully changeable during runtime. The only other thing that comes into my mind, is that you using the new .net 4.0 config transforms. You can provide 5 different publishsettings, could (at least I hope so) change the theme attribute in the web.config and use WebDeploy as your PublishMethod. Using the one-click-deployment provided by WebDeploy would make a temporary build with the selected settings and publish the changes (or full update, if you desire) to the target server. WebDeploy is so fast upon deployment.
citronas
In my company, we had a project, where the deployment onto the production server took roughly about 30 minutes, because the project had so many files in it. Now it is down to 5 minutes. Other smaller projects, that took 5 minutes for deployment, now take only some seconds. So my advice: Use WebDeploy
citronas
I don't know Why the rest of themes are unusable, and that's why I asked this question. But I do't use .net 4.0 config transforms. because I'm using Asp.net 2.0 and VS 2008. Actually the main question is that why changes in Web.Config need a different publish while it is XML and do not need a complie. I should Add this note that, App_Theme include all of 5 themes so that all of them Compiles and are ready to use.
Nasser Hadjloo
I found a solution here `http://bytes.com/topic/asp-net/answers/495850-themes-web-config` canyou please explain how he resolved this issue. I didn't work with `aspnet_compiler command`
Nasser Hadjloo