Я хотел бы переопределить метод OnActionExecuting контроллера, и я проверю действие, и пользователь контроллера имеет право или нет.
public class BrowseController : Controller
{
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
//TODO: ask service user has right this action.
//string actName = filterContext.ActionDescriptor.ActionName;
//string cntName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName
//foo(actName, cntName, userInfo) if return false go NoAccess page!
//filterContext.Result = new RedirectResult("_NoAccessRight");
base.OnActionExecuting(filterContext);
}
}
Я полагаю, что после проверки прав пользователя
filterContext.Result = new RedirectResult("_NoAccessRight");
Но я не смог получить страницу "_NoAccessRight", а также ~ / shared / _NoAccessRight "
Не могли бы вы дать идею? Спасибо.