有没有办法列出哪些角色可以通过代码访问给定页面?
例如,我有一个Testpage.aspx,我想在用户访问页面时列出该页面允许的角色.URLAuthorizationManager必须能够以某种方式找到它,因此必须有一种方法它知道在webconfig中为页面配置了哪些角色.或URL.
这是限制允许查看此页面的角色的webconfig.
<location path="Testpage.aspx">
<system.web>
<authorization>
<allow roles ="admin,sales" />
</authorization>
</system.web>
</location>
Run Code Online (Sandbox Code Playgroud)
如果我能找到解决方案,它将返回"admin","sales".谁知道我怎么能这样做?谢谢