在filter中获取action的参数值

public voidOnActionExecuting(ActionExecutingContextfilterContext)

中比较方便

有filterContext.ActionParameters,key:value,直接可以获得

但是在其他的

public void OnActionExecuted(ActionExecutedContext filterContext)

 

public void OnAuthorization(AuthorizationContext filterContext)

等等这些参数没有提供ActionParameters

 

filterContext.ActionDescriptor.GetParameters()通过ActionDescriptor可以获得参数名,但是无法获得参数值

参数值可以通过

filterContext.Controller.ValueProvider.GetValue(“??”)

来获得,也不知道这东西性能怎么样

posted @ 2011-11-01 11:54  czcz1024  阅读(1800)  评论(0编辑  收藏  举报