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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You would use the Web.config
to configure access:
<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>