如何授权Web窗体与ASP.NET身份的角色? [英] How to authorize roles with ASP.NET Identity in Web Forms?
本文介绍了如何授权Web窗体与ASP.NET身份的角色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何授权只在处于一定的作用用户签订一个页面?我不使用MVC,我不能使用[授权(角色=管理员)]属性。
How do I authorize a page to only signed in users that are in a certain role? I am not using MVC, I cannot use the [Authorize(Roles="Admin")] attribute.
推荐答案
您会使用的Web.config
配置访问:
<configuration>
<!-- Allow only Administrators to visit RoleBasedAuthorization.aspx -->
<location path="RoleBasedAuthorization.aspx">
<system.web>
<authorization>
<allow roles="Administrators"/>
<deny users="*" />
</authorization>
</system.web>
</location>
</configuration>
这篇关于如何授权Web窗体与ASP.NET身份的角色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文