ASP.NET theme does not display correctly

I have a small web application that uses themes. Themes work on the host, so in preinit, if host = a, load x theme, if host = b, load the theme.

In my code, it looks like this:

If request.url.host.contains ("a") Then Page.Theme = x is still request.url.host.contains ("b") Then Page.Theme = y

I have a url that is a.abc.com and the other is b.abc.com (well, it is this structure, but the letters make sense / company names). The problem is that (and I did host == ""), when I debug my site on localhost (another suggestion in the block above, where host = localhost), the style looks great. Aligning the elements is perfect, as I expect, with the numerical values ​​I provided for width, margins, etc. In css. But when I use the VS2008 publishing tool (with updatable ticking) and upload to a.abc.com, which has the same stylesheet as localhost (copy in my own folder), there are all kinds of alignment problems, as if I don't did no work. Why are my styles not showing correctly @runtime? If this helps, I am using VS2008 Pro Edition, IIS6 and Windows Server 2003.

What disappoints is that the source of the page indicates that the theme loads normally, as it is mentioned in the HTML header. Therefore, when I publish, the theme for a.abc.com is downloaded and referenced. Apart from all this information, there is no obvious sign of a problem. I did not try to conditionally refer to one CSS file in ASPX markup, but if I did this and it worked, then this also does not explain the problem.

thank

0
source share
4 answers

Do you install the theme early enough in your code? The theme should be applied to the page at the very beginning of the request life cycle in the PreInit event, if you do this with code.

+1
source

, , . , - , Theme web.config.

+1

, preinit.

, . ( ) , localhost, . , , ..

, , - / , , , css - , , .

0

-? ASP.Net Development Server App_Themes (, Login.aspx ForgotPassword.aspx). , , App_Themes . -, IIS , Cassini .

web.config, .

                      

, , IIS .

0

Source: https://habr.com/ru/post/1775428/


All Articles