Matt
Matt

Reputation: 1241

CSS not loading for Forms Authentication

I have seen several of these topics on numerous sites and I am still having an issue. I have added this to the bottom of my web.config right before the </configuaration>

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

Yet my css is still not loading for all users.

Here is the forms part of my web.config

<authentication mode="Forms">
      <forms name ="WebApp.ASPXAUTH"
            loginUrl="login.aspx"
             protection="All"
             path ="/"/>
    </authentication>
    <authorization>
      <allow users ="*"/>
    </authorization>

Is there something else I am missing?

Upvotes: 3

Views: 4352

Answers (3)

Erick Lanford Xenes
Erick Lanford Xenes

Reputation: 1572

For me, it works including access to the resources folders (Content, Scripts) in the web.config.

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

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

Upvotes: 0

user823883
user823883

Reputation: 91

I put inside the css folder a webconfig with that code:

<?xml version="1.0"?>
<configuration>

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

</configuration>

Sucess! :)

Upvotes: 9

IrishChieftain
IrishChieftain

Reputation: 15253

Put your CSS in a non-protected folder and this should work for you.

<link rel="stylesheet" src="path of the stylesheet" type="text/css"> 

Upvotes: 4

Related Questions