开发者

How can you prevent Formsauthentication to block css and images?

开发者 https://www.devze.com 2023-01-04 18:45 出处:网络
I have a project containing an image, css and js folder. I want to make sure no css, image or js is blocked when using formsauthentication.

I have a project containing an image, css and js folder.

I want to make sure no css, image or js is blocked when using formsauthentication.

I know you can do this with the locationtag in the web.config but I was wondering if you could do this otherweise?

this is how I do it right now:

<location path="css">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>开发者_高级运维
    <location path="images">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>

I'm using asp.net (c#) with iis 7.0.

Cheers, M.


Set the folder permissions for your CSS/images directories, to allows anonymous access.

This is done in the web.config, not filesystem permissions.


It is a good practice to serve static resources such as images and css from a cookie-free domain.


I was seeking the same answer however in my case it is allowing access to CSS, Images and JS files by default. I think it only requires authentication if for ASPX (etc).

Also, I am using deny users "?" rather than "*"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号