Web.config拒绝递归访问子文件夹 [英] Web.config Deny access to subfolder recursively

查看:76
本文介绍了Web.config拒绝递归访问子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的网站上有一个名为Admin的子文件夹,并且此文件夹有更多子文件夹.如何配置位于Admin文件夹中的web.config文件,以递归地影响其中的所有子文件夹?

If I have a sub folder in my website called Admin and this folder has more sub folders. How can I configure a web.config file, that sits in Admin folder, to effect all the subfolders in it recursively?

当前我有这个,但是它仅适合admin文件夹,并且不影响子文件夹

Currently i have this, but it only caters for the admin folder, and doesn't effect the sub folders

<location path="Admin">
<system.web>
  <authorization >
    <deny users="?"/>
    <allow roles="Admins"/>
  </authorization>
</system.web>

谢谢.

推荐答案

您需要拒绝所有其他用户.默认情况下,允许所有用户(包括来宾)访问所有文件夹.如果要拒绝对除某些用户或角色以外的任何人的访问,则需要在所有规则之后拒绝此访问.这也暗示着客人.

You need to deny all other users. By default, all users (including guests) are permitted to access all folders. If you want to deny access to anyone except certain users or roles, you need to deny this access after all rules. This implies to guests also.

<system.web>
  <authorization >
    <allow roles="Admins"/>
    <deny users="*"/>
  </authorization>
</system.web>

正在逐一检查规则,因此管理员适合第一个规则并获得访问权限.所有其他用户和来宾都将遵循第二条规则,并且将无法访问.

The rules are being checked one by one, so an admin fits to the first rule and getting access. All other users and guests will fall to the second rule and won't get access.

这篇关于Web.config拒绝递归访问子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆