[英]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. 我开始在我的asp.net网站上使用dotless,这需要特殊的httphandler才能工作。 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.
这是问题所在:当我登录到http://example.org/stylesheets/mystyles.less的请求时,效果很好。 It gives me back the appropriate css.
它给了我适当的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>
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>
不知道这是否是问题,但是您在xml中缺少引号。
<location path="~/stylesheets">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.