如何保证网页在ASP.Net的角色? [英] How to secure webpages in ASP.Net with roles?
本文介绍了如何保证网页在ASP.Net的角色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序有不同的角色和offcourse多个页面。我该如何保护,可能不会被某些角色访问网页?
In my application I have different roles and offcourse multiple pages. How do I secure webpages that may not be accessed by certain roles?
想象一下,1组可以访问网页a.aspx,b.aspx和c.aspx但不与网页d.aspx。我该如何保护,当第1组类型的d.aspx用户自己无法查看的页面?
Imagine group 1 has access to webpage a.aspx, b.aspx and c.aspx but not to webpage d.aspx. How do i secure that when a user of group 1 types in d.aspx he cannot view the page?
推荐答案
您必须在web.config中,哪个角色能得到哪些页面中添加。
You have to add in web.config, which Role can get which page.
<location path="yourPage.aspx">
<system.web>
<authorization>
<deny users="?"/>
<allow roles="Super Admin"/>
<deny users="Admin"/>
</authorization>
</system.web>
</location>
这篇关于如何保证网页在ASP.Net的角色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文