【问题标题】:How to restrict the access to a folder to users in specific roles如何将文件夹的访问权限限制为特定角色的用户
【发布时间】:2018-05-07 16:23:34
【问题描述】:

我一直在尝试在 web.config 中使用以下代码,该代码位于我想要限制访问但没有成功的文件夹中,因为每个具有文件路径的用户都可以访问它,任何人都知道什么错了吗?

web.config:

<?xml version="1.0"?>
<configuration>
    <system.web>
      <authorization> 
        <allow roles="Administrador, Executivo, Publico" />
        <deny users="?" />
      </authorization>
    </system.web>    
</configuration>

位于“上传”文件夹中

我正在使用表单身份验证,它是在主 web.config 中配置的:

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>

这可能是 IIS 配置问题吗?有人知道吗?

【问题讨论】:

    标签: .net security web-config


    【解决方案1】:

    为 web.config 文件使用下面的代码

    <?xml version="1.0"?> 
      <configuration>
        <system.web>
          <authorization> 
            <allow roles="Administrador, Executivo, Publico" />
            <deny users="*" />
          </authorization>
        </system.web>     
      </configuration>
    

    【讨论】:

    • 没什么区别
    • 中有所不同
    • 我的意思是它仍然没有阻止任何类型的用户访问该文件夹。
    • 似乎 web.config 在那里没有做任何事情
    猜你喜欢
    • 2016-10-15
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    • 2015-12-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多