CSS is not applied on login page in ASP.NET

Hi All,
If you are working with asp.net and you tried to apply css classes on your web application which is linked in your master page. You might face a problem that the css classes doesn’t show on your login page but it shows properly after you logged in to your application by clicking on sign out link.

The problem is a security permission problem, since by default the asp.net application has a rule that doesn’t allow all users to access folder within your project, to fix this problem, you want to allow all users to access your css file in your folder, So let’s say you have css files in your <strong>Styles </strong>folder in your web project; You need to allow in web.config access for all users to access these files, so this fixes this problem in login.aspx page.

Add the following in your web.config to fix this issue:

<location path=”Styles”>
<system.web>
<authorization>
<allow users=”*” />
</authorization>
</system.web>
</location>


After applying this, try to run your application and you will see the css classes are applied on your login page.

Hope this helps.

Regards,
Mostafa Arafa
twitter.com/mostafaelzoghbi

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>