Limit file access to specific users in IIS

喜你入骨 提交于 2019-12-12 13:26:54

问题


I'm running an ASP.NET web site on IIS 6.0 (Windows 2003), and the site uses "integrated windows authentication". The IWA configuration is not a must (until now), but is configured anyway. The application pool runs as the "Network Service". Also, in web.config, there's the line "". The problem I'm facing now is that there's a new request to limit access to a specific page, so that only a limited number of users (a single group in the active directory) could gain access to it.

I've been trying to change NTFS permissions on that file, but this doesn't work, as IIS is using "Network Service" to access the file, regardless the rest of the permissions. Removing "Network Service" (or the "Users" group) from the ACL, would cause the page not to work at all.

So how can I limit access to a specific page, only for specific users?


回答1:


You can use the following in your web.config:

<configuration>
   <location path="ProtectedPage.aspx">
      <system.web>
         <authorization>
            <allow users="SomeUser"/>
            <deny users="?"/>
         </authorization>
      </system.web>
   </location>
</configuration>


来源:https://stackoverflow.com/questions/277695/limit-file-access-to-specific-users-in-iis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!