Scott
Scott

Reputation: 11206

Restrict Area to a given role

I have an area setup in MVC2, called Admin/, which I want I only want Users who belong to the role "admins" to have access. I know I can decorate each of the methods with [Authorize(Roles="admins")], but this seems tedious when your talking about multiple controllers with multiple actions.

Is there an better and cleaner way?

Upvotes: 4

Views: 1188

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039160

You could define a base controller decorated with this attribute that all controllers in the area derive from.

Upvotes: 7

Related Questions