我有一个像这样的基本控制器
[Action]
public abstract class ApplicationController : Controller
{
public bool HasRight { get { return ((bool)ViewData["Actions2"]); } }
.........
}
动作属性
public class ActionAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
filterContext.Controller.ViewData["Actions2"]=true;
.........
}
}
当我从某个控制器调用某些视图时,我得到空异常
public bool HasRight { get { return ((bool)ViewData["Actions2"]); } } as ViewData is null