Frage

I recently began working on a large ASP.NET WebForms project.

The project was using the App_Themes directory with a lot of disorganized CSS and image resources.

I discovered that every CSS file in the theme's directory is loaded whether I want it or not, and they're all loaded in alphabetical order.

I obviously prefer to have more control and flexibility over my CSS and front-end resources, I moved them all to a separate directory then deleted the entire App_Themes folder.

This seemed like a simple matter of just moving resources, but after deploying to our production server the system soon became unstable and the App Pool was repeatedly crashing.

Restoring the App_Themes directory made the system stable again, but this makes no sense to me. The App_Themes folder, and any possible dependencies it may have, just seems like a strange black box that I cannot figure out and cannot seem to move away from.

War es hilfreich?

Lösung

App_Themes is one of the "special directories" in ASP.Net. While it may not be required (you won't see them these days by default), they maybe referenced in configuration (web.config), any skinned controls, Pages, etc. - and perhaps that is why the app was being unstable after you removed the folder (broke all references to it).

Check for such references - you can (re)move css files from the themes defined so you can start with a blank slate if that is what you want. Unless you can find and remove all the references to theme usage in your app, avoid modifying the directory structure.

App_Themes can be powerful. You can easily change the look (aka "theme) your entire site simply with one change in web.config

<system.web>
    <!-- chage this value to "fall" in the Fall -->
    <pages theme="Summer" />
</system.web>

The "Summer" theme setting above maps to "Summer" subfolder in App_Themes containing the stylesheets/skins of the Summer theme. If you have "Fall" theme, then that maps to same named subfolder in App_Themes...

Ref: ASP.Net Themes/Skins

hth

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top