ASP.NET MVC 5: Custom authentication with OnActionExecuting

0 0 votes
Article Rating

Although I prefer the AuthorizeAttribute approach, there is another simpler way with a base Controller and OnActionExecuting:

Let’s assume the following Controller:

All you need is a base controller with OnActionExecuting overridden, to check before each action for the proper rights…:

And of course you need to change every Controller of your app to inherit from your base:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments