我想知道一个动作方法是否有[HttpPost]。我的代码如下。但它总是返回null。
string actionName = filterContext.RouteData.Values["action"].ToString();
Type controller = filterContext.Controller.GetType();
MethodInfo method = controller.GetMethod(actionName); //OK Code
var attribute = method.GetCustomAttribute(typeof(HttpPostAttribute), true); //returns null
有什么建议吗?