I am trying to create an attribute that I can set for my action with controllers in which I can check if the user is any role. I know with standard asp.net authentication, this is already possible, but I do not use this.
So what I want to do is:
[Role("Admin", "SuperUser")]
public ActionResult SafeCourse()
I built this:
public class AdminAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
Ans now ..... I want to redirect the user to some kind of controller / action or if it is impossible for some presentation when he / she is not in the right role. But I'm not in my usual context (= controller), and I'm somewhat lost :)
Michelle
source
share