views:

251

answers:

2

I've set up Forms Authentication on my ASP.NET MVC website, including setting up appropriate entries in the web.config.

Now every request to my site redirects to the Login page to authenticate the user.

Problem is, this happens even when my pages try to access the master stylesheet (in the Content folder), so they end up rendering without styles.

How can I override Forms Authentication so that my style sheet will render?

+4  A: 

You need to exclude stylesheets from security in your web.config:

    <location path="App_Themes">
     <system.web>
      <authorization>
       <allow users="*"/>
      </authorization>
     </system.web>
    </location>
Chris KL
+1  A: 

if you are dealing with just one css file then you can add an exception on your web.config simiarly to what Chris KL wrote, but with the css file name instead:

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