3

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?

4
  • Can you be more descriptive about what "not loading for all users" means? Some users get the CSS but others don't, I get that. Anything you can tell us about that? Does the CSS load occur after a successful login only, for example? Does the CSS load for those who have had a successful login in the past perhaps but not load for new users who have not successfully logged in? If a user logs in with not having the CSS load does it then load? Commented Jun 27, 2011 at 19:16
  • It works for me after a successful login. I clear my cache and cookies and it is right back to not working for me. It does not load for anyone who has never opened the application before. Even if they successfully login. Note: it has only worked for me once before I cleared my cache so that may have been something stuck. I can not get it to work for me at all either even with a successful login. Commented Jun 27, 2011 at 19:19
  • Which browser? Running on https? Commented Jun 27, 2011 at 19:25
  • No https. Firefox, IE, and Chrome. I have been using Firebug to see when it loaded and when it doesn't. Commented Jun 27, 2011 at 20:12

3 Answers 3

9

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! :)

Sign up to request clarification or add additional context in comments.

Comments

4

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"> 

5 Comments

If I split the CSS will I need to tell the application where it is located?
No need to split it up, aside from organizational purposes. Put all your CSS in a non-protected top-level folder. Pages need to have a link to the CSS... if you're using master pages, put it there; you can drag and drop from Solution Explorer into the head section :-)
Can I move the CSS to a different folder, create a virtual directory for my CSS, and change the web.config to allow users to this folder? Or am I misunderstanding?
You're misunderstanding; CSS should be in a non-protected folder - no permissions involved. Just create a CSS link in your pages to point to a common CSS folder containing your CSS stylesheet(s).
I was just about to say I misunderstood because I was still getting a 404. I will try that and let you know.
0

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.