Our application is migrating from WebForms to MVC. We have another way to handle permissions. A database query is requested to confirm user authorization. This view returns, according to each user, the entire menu hierarchy. For example, if user1 tries to access a page called SecretList.aspx, the search is applied through the menu hierarchy (stored in the HTTP session after authorization) to check access authorization. If a menu item associated with SecretList.aspx exists for this user, access is granted.
My question is: how to implement this approach in ASP.NET MVC 3?
I would not want to add attributes for each Controller action, and I read about route restrictions and the user controller .
To restrict the route, can I access an HTTP session and get my menu hierarchy to request authorization?
In a user controller, which method should be considered when overloading? Can I check the authorization and redirect to another view before the controller executes the full action code?
Any other better idea?
source
share