ASP.NET 授权设置
我想在 ASP.NET 应用程序中设置授权权限。
因此,在一个特定文件夹中,我想拒绝一个特定用户的访问,该用户角色被授予为允许该特定用户。
<authorization>
<allow roles="General" />
<allow roles="Sale" />
<allow roles="Administrator" />
<deny users="admin_test" />
</authorization>
但是,当我尝试使用 admin_test 帐户访问该特定文件夹中的页面时,系统允许我访问该页面而不是拒绝访问。
谁能指出上面的配置有什么问题吗?
任何帮助将不胜感激。
问候,
兰
I want to setup a authorization permission in ASP.NET application.
Hence , in one particular folder I want to deny the access of one particular user which user role is granted as allow for that particular.
<authorization>
<allow roles="General" />
<allow roles="Sale" />
<allow roles="Administrator" />
<deny users="admin_test" />
</authorization>
However , when I tried to access the pages from that particular folder by using the admin_test account , system allow me to access the page instead of denying the access.
Can anyone point out what wrong with above configuration?
Any help would be much appreciated.
Regards,
Ran
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要首先列出
deny
。授权引擎将在第一个匹配规则处停止:You need to have the
deny
listed first. The authorization engine will stop on the first matching rule:根据 http://msdn.microsoft.com/en-us/library/ wce3kxhd.aspx
因此,如果 admin_test 用户属于常规、销售、管理员角色中的任何一个,它将首先匹配并允许访问。尝试将拒绝规则放在允许规则之前。
According to http://msdn.microsoft.com/en-us/library/wce3kxhd.aspx
So if the admin_test user is in any of General, Sale, Administrator roles, it will match first and allow the access. Try putting the deny rule before allow rules.