Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,

I am creating an application in which I am doing forms authentication. I need to show a default page with a login link, normal user can see the form and admin can login and make necessary changes.

But when I configure forms authentication the images and CSS on default page works only when someone logins, otherwise they didn't work. I am using Master page also.

Master page, css folder and images folder exist on Root.

Please suggest how I can fix this issue.

Thanks,
Jagjot
Posted
Updated 23-Mar-11 19:53pm
v2

In your web.config add for css, images folder
XML
<location path="css">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>


see here[^]
 
Share this answer
 
v2
Comments
Espen Harlinn 24-Mar-11 5:03am    
my 5 - nice and simple
m@dhu 24-Mar-11 5:10am    
Thanks Espen.
You need to read on Web.Config Authorization tag.
Here:
authorization Element (ASP.NET Settings Schema)[^]
HOW TO: Control Authorization Permissions in an ASP.NET Application[^]
Format of ASP.NET Configuration Files[^]

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

This would allow everyone visiting the login page and thus CSS would be applied.
 
Share this answer
 
Comments
Espen Harlinn 24-Mar-11 5:04am    
my 5 - nice and simple, backed by a number of good links :)
Sandeep Mewara 24-Mar-11 5:14am    
Thanks Espen.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900