I've implemented my own Authorize
attribute, and I notice that it queries to check permissions when I use [Authorize]
.
Is there any way I can get that permission and use it in the current controller that applies the Authorize
attribute without having to rewrite and requery the code in the controller?
Yes, you can. If you implemented your Authorize attribute as an ActionFilterAttribute you can use the ViewData collection to store information like this :
In the anoteated controller's acrion you can access the field with: