使用在web.config中多个授权元素 [英] using multiple authorization elements in web.config
问题描述
是否有可能使用多个授权的元素在一个单一的web.config文件,以允许其他用户访问一个文件?
例如,我想允许只Page1.aspx的用户1访问整个应用程序(包括Page1.aspx的),和用户2访问:
<&的System.Web GT;
<授权>
<让用户=域\\用户1/>
<拒绝用户=*/>
< /授权>
< /system.web>
<位置路径=〜/ Page1.aspx的>
<&的System.Web GT;
<授权>
<让用户=域\\用户2/>
<拒绝用户=*/>
< /授权>
< /system.web>
< /地点>
我相信你可以用逗号分隔的用户列表,所以应该没有必要使用多个授权要素的单一资源。
此外,它通常是最好依赖于角色而不是特定用户。因为它似乎使用的是AD,那么你可以使用的角色类似于一个安全组或东西。
Is it possible to use multiple authorization elements in a single web.config to allow additional users access to one file?
E.g., I would like to allow User1 access to the whole application (including Page1.aspx), and User2 access to only Page1.aspx:
<system.web>
<authorization>
<allow users="DOMAIN\User1" />
<deny users="*" />
</authorization>
</system.web>
<location path="~/Page1.aspx">
<system.web>
<authorization>
<allow users="DOMAIN\User2" />
<deny users="*" />
</authorization>
</system.web>
</location>
I believe you can use a comma delimited list of users, so there should be no need for using multiple authorization elements for a single resource.
Also, it is generally better to rely on roles instead of specific users. Since it appears you are using AD, then you can use a security group or something similar for the roles.
这篇关于使用在web.config中多个授权元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!