Wednesday, 21 August 2013

Get parameter's value of a Data Annotation

Get parameter's value of a Data Annotation

The goal
Get parameter's value of a Data Annotation.
The problem
I don't know the syntax.
The scenario
There is the following controller on my application:
[PermissionsFilter(Roles = "Administrator")]
public ActionResult Index()
{
return View();
}
And there is the following method on my application:
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
return true;
}
What I need seems to be simple: how do I get the Administrator string on
the AuthorizeCore method?
Knowledge spotlight
The AuthorizeCore is within of PermissionFilters class that implements
AuthorizeAttribute. In other words, I'm overriding the AuthorizeCore
method of Authorize attribute to create a new one (PermissionFilters
attribute).

No comments:

Post a Comment