Reputation: 3057
I am building a website with asp.net mvc 4. I using basic role management . The thing i want to do is that i want to give access to any url based on users's role. I was thinking that can we do this via Custom Filter . Because i don't want to write Role attribute on each action .
So What i think is i am going to define role based urls in database and then on OnActionExecuted
event i want to check that the requested url is allowed to current user or not . Is this possible ?
Upvotes: 1
Views: 408
Reputation: 5137
While it is possible I will not do it for following reasons:
OnActionExecuting
event is pretty early in application execution pipeline. Doing heavy operations that involves going to database should be avoided.Upvotes: 1