Microsoft dotnet .NET6

In this post I show how to fix your ASP.NET application if the CSS not loading from App_Themes.

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in a Web application, across an entire Web application, or across all Web applications on a server.

A set of example ASP.NET themes is also available: Download.

Themes and Control Skins

Themes are made up of a set of elements: skins, cascading style sheets (CSS), images, and other resources. At a minimum, a theme will contain skins. Themes are defined in special directories in your Web site or on your Web server.

Skins

A skin file has the file name extension .skin and contains property settings for individual controls such as ButtonLabelTextBox, or Calendar controls. Control skin settings are like the control markup itself, but contain only the properties you want to set as part of the theme. For example, the following is a control skin for a Button control.

The problem

I am having problem while loading the CSS file through App_Themes folder but with ASP.NET authentication doesn’t work. The solutions are two. First you have to insert in web.config this tag:

<configuration>
    <location path="App_Themes/YourThemeFolder">
    <system.web>
        <authorization>
            <allow users="*" />
        </authorization>
    </system.web>
    </location>
</configuration>

The second solution (that it is always working) is changing tag page on web.config.

<pages styleSheetTheme="YourThemeName"> </pages>
ASP.NET - CSS not loading from App_Themes
ASP.NET

More about ASP.NET

By Enrico

My greatest passion is technology. I am interested in multiple fields and I have a lot of experience in software design and development. I started professional development when I was 6 years. Today I am a strong full-stack .NET developer (C#, Xamarin, Azure)

3 thoughts on “CSS not loading from App_Themes”
  1. Thank you for your guide! It helped me.
    You have the typo in the line “Blazor’s lunchSettings.json file:”. It should be launchSettings

    1. Thank you! I think you put a comment in the wrong post. When do you say “You have the typo in the line “Blazor’s lunchSettings.json file:”. It should be launchSettings” what do you refer to?

This site uses Akismet to reduce spam. Learn how your comment data is processed.