Question

I converted an existing website from ASP.NET 2.0 to ASP.NET 4.0.

Now when I see the network tab in Firebug I see the css files in my root/css folder are retrieved upon each request with 200 OK response. So they are not cached.

Although the css files I have in my aspnet Theme are getting cached. So I moved the /css folder files in Themes folder and those files are now cached.

Why are styles in folder other than Themes aren't cached? I wonder if I am missing some configuration setting?

P.S.: I am running the new website from VS2010/DevServer/FireFox.

Was it helpful?

Solution

The reason the files in css folder were retrieved on every request was because my website required login and has anonymous access denied.

In my web.config I had explicitly allowed all users to App_Themes folder and that is why it seemed to be cached. So I added the following to my web.config and no more additional request for those files.

<location path="css">
   <system.web>
        <authorization>
                <allow users="*" />
        </authorization>
   </system.web>
</location>

Those css files weren't used on the home login page so never occurred it could be the access issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top