Reputation: 2199
What is the exact difference between Authorization filters and Action filters in MVC?
For checking user session or validating user login, for these purposes which one should i use?
I am new to MVC, Please explain rather providing links also it will be helpful if you could give its samples of usage.
Upvotes: 2
Views: 1507
Reputation: 348
Authorization Filter is a specialized filter to check whether a user is authorized to access certain resources, while with action filter you could create custom filter overriding the OnActionExecuting
, OnActionExecuted
, OnResultExecuting
and OnResultExecuted
method, depends on your purpose. I used Action Filter to check user's session.
Here's a nice article explaining action filter
For authorization there's a neat library called fluent security to implement authorization features, as alternative to the original which I think easier to implement
Upvotes: 1