Jordy Zandbergen Jordy Zandbergen - 1 year ago 178
ASP.NET (C#) Question

How to authorize roles with ASP.NET Identity in Web Forms?

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.

Answer Source

You would use the Web.config to configure access:

     <!-- Allow only Administrators to visit RoleBasedAuthorization.aspx -->    
     <location path="RoleBasedAuthorization.aspx">    
                    <allow roles="Administrators"/>
                    <deny users="*" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download