Answer the question
In order to leave comments, you need to log in
Is it possible to get data from an attribute applied to a class in an attribute applied to a class method?
I'm creating an authorization attribute for an ASP.NET MVC controller. At the controller class level, I apply an attribute that checks the user's rights to access the controller. At the level of the controller's action method, I apply an attribute that checks whether the user has the right to perform this action. For example:
[MyAuth("booksmanagers")]
public class BookController
: Controller
{
[MyAuthRight("booksmanagers", "create")]
public ActionResult Create()
{
return View();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question