asp.net - 如何允许匿名用户浏览Style文件夹

标签 asp.net web-config authorization

在我的网络应用程序中,我希望匿名用户仅浏览登录页面,现在可以了,但它看起来没有样式!

<authorization>
    <deny users="?"/>
    <allow users="*"/>
</authorization>

</system.web>

<location path="Style">
  <system.web>
    <authorization>
      <allow users="?" />
    </authorization>
  </system.web>
</location>

任何帮助!

最佳答案

从此article :

Images and CSS files

Say you have all your images and CSS in a seperate folder called images and you are denying anonymous access to your website. In that case you might see that on your login page you cannot see images(if any) and css(if any) applied to your login page controls.

In that case you can add a web.config to the images and css folder and allow access to everyone to that folder. So your web.config in images folder should look as below:

<configuration>
   <system.web>
      <authorization>
        <allow users="*"/> //Allow everyone
      </authorization>
   </system.web>
</configuration>

关于asp.net - 如何允许匿名用户浏览Style文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5164718/

相关文章:

wcf - 在 IIS 8.5 上部署 WCF

authentication - 当最终用户为站点添加书签时,如何处理 OAuth2 状态的重用?

javascript - ASP.NET - 仅在需要时提示确认

asp.net - ASP.NET MVC 之上的一些框架可以轻松创建网站的后端部分?

c# - 无法打开物理文件操作系统错误 32

authorization - 如何将管理员的更改传播到用户的声明

php - Laravel 索引策略

javascript - 单击后禁用 asp.net 按钮以防止双击

asp.net - 在 ASP.NET 中修改服务器端的 html 输出

c# - 在路径/文件夹下注册HttpHandler