Micah
Micah

Reputation: 116150

Allow anonymous access to a special file in Asp.Net

I started using dotless in my asp.net site which requires a special httphandler to work. The site uses Forms Authentication. Here's the problem: When I'm logged in the request to http://example.org/stylesheets/mystyles.less works fine. It gives me back the appropriate css. If I'm not logged in the request is denied and I'm redirected to the login page. Is there a way to allow this file to be accessed anonymously? This is not working:

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

Upvotes: 1

Views: 5329

Answers (2)

Micah
Micah

Reputation: 116150

The problem is with the path syntax.

This does not work:

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

This DOES work:

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

Upvotes: 9

Shawn Steward
Shawn Steward

Reputation: 6825

Not sure if this is the problem but you're missing a quote mark in your xml.

<location path="~/stylesheets">

Upvotes: 0

Related Questions