0

I created an ASP.NET program the default way with VS 2012.
My Site.css is in the Content folder.
My WebConfig is altered to deny access to anyone not authorized eg "? users", except to reach the login page.

I recently made a new build, which didn't touch my CSS or paths or any accessibility of my pages, but despite having previously worked the CSS on the login page is now broken - unless you logout and get redirected to it. After refreshing it, it still returns to broken.

My question is less of "What specifically is causing this problem" but more "How can I find the root of this problem?"
I'm going to attempt making the content folder publicly accessible as my solution, but I'm still curious why something like this could happen.

1 Answer 1

1

It seems that you disabled anonymous access to every files and folders in your application.

If so, you can create a web.config file inside Content folder with the following content to allow anonymous access back to every file inside that folder.

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

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

</configuration>

Or in application level web.config file you can add with the rest of the code.

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

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

</configuration>
Sign up to request clarification or add additional context in comments.

4 Comments

That seems a little better than putting it in the top level web config. But the most curious thing is that I still somehow disabled anonymous access to it without changing anything related between builds.
Yes, you can place it inside application level web.config file too. Web Server has root web.config too; you might want to see whether it has been modified.
Yeah. It worked fine without it in the application or directory level web.config, until suddenly it didn't. There were no changes in the server web.config either.
There are too many possibilities. I could not say without look inside IIS settings, and directory permissions.

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.