我有自定义WebViewPage,在这个类中,我有需要从ActionFilter初始化的属性。在这个过滤器中我有方法OnActionExecuting(ActionExecutingContext filterContext)。我可以从自定义WebViewPage访问属性吗?
CustomViewPage
public class BaseViewPage : WebViewPage
{
public List<IAlert> Alerts { get; set; }
public override void Execute() { throw new NotImplementedException(); }
}
ActionFilter
public class MessageFilter : IActionFilter
{
public void OnActionExecuted(ActionExecutedContext filterContext) { }
public void OnActionExecuting(ActionExecutingContext filterContext)
{//I NEED ACCESS HERE TO ALERTS PROPERTY FROM BASEVIEWPAGE
}
}
答案 0 :(得分:0)
public void OnActionExecuting(ActionExecutingContext filterContext)
{
//I NEED ACCESS HERE TO ALERTS PROPERTY FROM BASEVIEWPAGE
BaseViewPage obj = new BaseViewPage();
obj.Alerts // your logic
}