CSS not being applied on non authenticated ASP.NET page

asp.netcss

When developing (works fine live) the pages for our website don't pick up the correct CSS until the user has authenticated (logged on).

So the Logon and Logoff forms look bad, but once inside the site, the CSS works again.

I'm guessing it's some kind of authentication issue? Haven't really looked into it too much because it's only when working on dev so not a huge issue, but would be nice to know how to fix it.

Best Solution

To allow an unauthenticated user to see your .css files (or any other file/directory) you can add a location element to your web.config file pointing to the .css file.

<configuration>
   <system.web>
      // system.web configuration settings.
   </system.web>
   <location path="App_Themes/Default/YourFile.css">
      <system.web>
         <authorization>
            <allow users="*"/>
         </authorization>
      </system.web>
   </location>
</configuration>