Question : site.css not showing for login.aspx pages

I'm not sure what I did, but I'm pretty sure it was my fault...

I have an ASP.NET 4.0 project created with VS 10 VB.NET.  I created the project as ASP.NET (not Empty) and it was nice enough to create all my login pages for me.

All went well until I broke something when adding authentication/authorization to the site.

Now when someone is redirected to the login page, none of the site.css settings are applied.  Once they have successfully logged in, .css works just fine.

When I look at the code behind using the "Developers Tools" in Explorer 8.0, I see that the file being referenced (Styles\Site.css) is being called before Authentication with "Unknown" in the content and after Authentication with the full .css loaded.

This seems to be an Auth problem, but I can't figure out how to fix it.  I've tried changing security settings on the site.css file.  I've tried adding the .css file to the "location" portion of web.config.

I'm pretty sure it is something else I've done earlier, because when I try to retrace my steps with a new Test site created the same way, I don't have the same problem when I add Auth to that new site.  I just can't figure out what the difference is...  Grrrrr!

I am not very familiar with the IIS, .css and/or Auth set up, so any advice would be welcome at this point.

Thanks!!

Answer : site.css not showing for login.aspx pages

Do you see where you have

    <authorization>
      <deny users="?"/>
    </authorization>

This means deny to anonymous users. You should try allowing your css file through then just as you allowed your login page.

<configuration>

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

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

  <system.web>
    <authorization>
      <deny users="?"/>
    </authorization>
  </system.web>

</configuration>
Random Solutions  
 
programming4us programming4us