So on my journey to become better at ASP.NET I've encountered a problem.
I'm working on a login. I added some style to it by adding a CSS file and after some time I made it look a lot better. Thereafter I added ASP authentication forms - which actually works great as well except that if you're not logged in the CSS is not used.
Once I've logged in and received a cookie I can go back to the login page and everything looks nice. But as long as I haven't "logged in" the page looks as if no CSS is used.
How can I fix this?
You have to allow access to the CSS file:
<location path="~/stylesheets">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
Update to match the path to where you store your CSS.
You need to exclude the CSS folder (and for that matter any other folders) from the authorization using location in the web.config.
<location path="CssFolder">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With