繁体   English   中英

IIS 服务器:限制用户访问服务器文件

[英]IIS Server: Restrict users to access files of server

我有一台服务器,它允许用户免费托管他们的 web 应用程序。

在服务器中,我有 4 个不同的池。

2个池用于.Net Framework,1个池用于.Net MVC,1个池用于.Net Core 3.1

每个池有 50 多个应用程序。

对于安全测试,我创建了一个程序,它采用文件的完整路径/位置并从 IIS 服务器读取该文件。 如果任何用户在我的服务器中上传该类型的代码,那么他们可以评估任何文件。

现在,这是我的服务器的问题。

现在,我想做的是,我的用户只能访问他们的应用程序资源,而不能访问其他人的。

但是,我不知道该怎么做。

为了限制用户访问 IIS 中的文件,我们可以参考根 web.config 文件中的以下配置。

<location path="myfolder">
<system.webServer>
    <security>
        <authorization>
            <remove users="*" roles="" verbs="" />
         <!--for authentication, we should enable either windows authentication or form authentication in IIS authentication module.-->
            <add accessType="Allow" roles="Administrators" />
        </authorization>
    </security>
</system.webServer>
</location>

它将限制Myfolder下的所有内容。 特别是,排除特定文件。

     <location path="my.jpg">
     <system.webServer>
         <security>
             <authorization>
                 <remove users="*" roles="" verbs="" />
                 <add accessType="Allow" roles="Administrators" />
             </authorization>
         </security>
     </system.webServer>
 </location>

如果有什么我可以帮忙的,请随时告诉我。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM