Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot access CSS file from ASP.NET login page

I have just noticed a problem accessing a CSS file using forms authentication from an ASP.NET application.

Until I have logged in, then any styles I have set in my login page are not used, as IIS seems to be preventing the login page from accessing this file.

Is there an easy solution for this?

like image 776
Patrick McDonald Avatar asked Aug 17 '09 16:08

Patrick McDonald


2 Answers

My CSS didn't display in the login page as well.

I noticed that Anonymous Access was using the IUSR account not the IIS_IUSRS account so I just added IUSR to the website folder and everything got back to normal.

like image 162
Sigurbjörn Avatar answered Oct 22 '22 12:10

Sigurbjörn


Place the css file in a publicly accessible folder. This will require a change in your web.config that will look something like this:

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

Granted, this shouldn't be how you setup the permissions in the first place. The css folder ought always to be publicly accessible.

like image 45
Gavin Miller Avatar answered Oct 22 '22 11:10

Gavin Miller